@@ -77,6 +77,13 @@ void ansi_c_convert_typet::read_rec(const typet &type)
77
77
int32_cnt++;
78
78
else if (type.id ()==ID_int64)
79
79
int64_cnt++;
80
+ else if (type.id () == ID_c_bitint)
81
+ {
82
+ bitint_cnt++;
83
+ const exprt &size_expr = static_cast <const exprt &>(type.find (ID_size));
84
+
85
+ bv_width = size_expr;
86
+ }
80
87
else if (type.id ()==ID_gcc_float16)
81
88
gcc_float16_cnt++;
82
89
else if (type.id ()==ID_gcc_float32)
@@ -290,15 +297,13 @@ void ansi_c_convert_typet::write(typet &type)
290
297
291
298
if (!other.empty ())
292
299
{
293
- if (double_cnt || float_cnt || signed_cnt ||
294
- unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
295
- short_cnt || char_cnt || complex_cnt || long_cnt ||
296
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
297
- gcc_float16_cnt ||
298
- gcc_float32_cnt || gcc_float32x_cnt ||
299
- gcc_float64_cnt || gcc_float64x_cnt ||
300
- gcc_float128_cnt || gcc_float128x_cnt ||
301
- gcc_int128_cnt || bv_cnt)
300
+ if (
301
+ double_cnt || float_cnt || signed_cnt || unsigned_cnt || int_cnt ||
302
+ c_bool_cnt || proper_bool_cnt || bitint_cnt || short_cnt || char_cnt ||
303
+ complex_cnt || long_cnt || int8_cnt || int16_cnt || int32_cnt ||
304
+ int64_cnt || gcc_float16_cnt || gcc_float32_cnt || gcc_float32x_cnt ||
305
+ gcc_float64_cnt || gcc_float64x_cnt || gcc_float128_cnt ||
306
+ gcc_float128x_cnt || gcc_int128_cnt || bv_cnt)
302
307
{
303
308
log .error ().source_location = source_location;
304
309
log .error () << " illegal type modifier for defined type" << messaget::eom;
@@ -373,10 +378,10 @@ void ansi_c_convert_typet::write(typet &type)
373
378
gcc_float64_cnt || gcc_float64x_cnt ||
374
379
gcc_float128_cnt || gcc_float128x_cnt)
375
380
{
376
- if (signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
377
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
378
- gcc_int128_cnt || bv_cnt ||
379
- short_cnt || char_cnt)
381
+ if (
382
+ signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
383
+ bitint_cnt || int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
384
+ gcc_int128_cnt || bv_cnt || short_cnt || char_cnt)
380
385
{
381
386
log .error ().source_location = source_location;
382
387
log .error () << " cannot combine integer type with floating-point type"
@@ -415,10 +420,10 @@ void ansi_c_convert_typet::write(typet &type)
415
420
}
416
421
else if (double_cnt || float_cnt)
417
422
{
418
- if (signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
419
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
420
- gcc_int128_cnt || bv_cnt ||
421
- short_cnt || char_cnt)
423
+ if (
424
+ signed_cnt || unsigned_cnt || int_cnt || c_bool_cnt || proper_bool_cnt ||
425
+ bitint_cnt || int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
426
+ gcc_int128_cnt || bv_cnt || short_cnt || char_cnt)
422
427
{
423
428
log .error ().source_location = source_location;
424
429
log .error () << " cannot combine integer type with floating-point type"
@@ -460,10 +465,10 @@ void ansi_c_convert_typet::write(typet &type)
460
465
}
461
466
else if (c_bool_cnt)
462
467
{
463
- if (signed_cnt || unsigned_cnt || int_cnt || short_cnt ||
464
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
465
- gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
466
- char_cnt || long_cnt)
468
+ if (
469
+ signed_cnt || unsigned_cnt || int_cnt || short_cnt || bitint_cnt ||
470
+ int8_cnt || int16_cnt || int32_cnt || int64_cnt || gcc_float128_cnt ||
471
+ bv_cnt || proper_bool_cnt || char_cnt || long_cnt)
467
472
{
468
473
log .error ().source_location = source_location;
469
474
log .error () << " illegal type modifier for C boolean type"
@@ -475,10 +480,10 @@ void ansi_c_convert_typet::write(typet &type)
475
480
}
476
481
else if (proper_bool_cnt)
477
482
{
478
- if (signed_cnt || unsigned_cnt || int_cnt || short_cnt ||
479
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
480
- gcc_float128_cnt || bv_cnt ||
481
- char_cnt || long_cnt)
483
+ if (
484
+ signed_cnt || unsigned_cnt || int_cnt || short_cnt || bitint_cnt ||
485
+ int8_cnt || int16_cnt || int32_cnt || int64_cnt || gcc_float128_cnt ||
486
+ bv_cnt || char_cnt || long_cnt)
482
487
{
483
488
log .error ().source_location = source_location;
484
489
log .error () << " illegal type modifier for proper boolean type"
@@ -496,9 +501,9 @@ void ansi_c_convert_typet::write(typet &type)
496
501
}
497
502
else if (char_cnt)
498
503
{
499
- if (int_cnt || short_cnt || long_cnt ||
500
- int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
501
- gcc_float128_cnt || bv_cnt || proper_bool_cnt)
504
+ if (
505
+ int_cnt || short_cnt || long_cnt || bitint_cnt || int8_cnt || int16_cnt ||
506
+ int32_cnt || int64_cnt || gcc_float128_cnt || bv_cnt || proper_bool_cnt)
502
507
{
503
508
log .error ().source_location = source_location;
504
509
log .error () << " illegal type modifier for char type" << messaget::eom;
@@ -537,7 +542,9 @@ void ansi_c_convert_typet::write(typet &type)
537
542
538
543
if (int8_cnt || int16_cnt || int32_cnt || int64_cnt)
539
544
{
540
- if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
545
+ if (
546
+ long_cnt || char_cnt || short_cnt || bitint_cnt || gcc_int128_cnt ||
547
+ bv_cnt)
541
548
{
542
549
log .error ().source_location = source_location;
543
550
log .error () << " conflicting type modifiers" << messaget::eom;
@@ -574,6 +581,12 @@ void ansi_c_convert_typet::write(typet &type)
574
581
else
575
582
type=gcc_unsigned_int128_type ();
576
583
}
584
+ else if (bitint_cnt)
585
+ {
586
+ // explicitly-given expression for the number of bits
587
+ type.id (is_signed ? ID_c_signed_bitint : ID_c_unsigned_bitint);
588
+ type.set (ID_width, bv_width);
589
+ }
577
590
else if (bv_cnt)
578
591
{
579
592
// explicitly-given expression for width
0 commit comments