Skip to content

Commit dbb6a4d

Browse files
authored
Merge pull request #6030 from tautschnig/integer-promotion
C front-end: support ID_integer-typed expressions in get_c_type
2 parents 03a24d9 + ef1f40a commit dbb6a4d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
main.c
3+
--show-goto-functions
4+
^[[:space:]]*ASSIGN main::1::b := main::1::b \* cast\(100, ℤ\)$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^[[:space:]]*ASSIGN main::1::b := main::1::b \* 100$
9+
--
10+
implicit_typecast_arithmetic previously failed to insert a typecast for the
11+
(mathematical) integer-typed expression. This resulted in a multiplication over
12+
mixed types, which sometimes (!) resulted in an invariant failure during
13+
simplification. This was first observed when compiling with GCC 10, cf.
14+
discussion in #6028.

regression/validate-trace-xml-schema/check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
['xml-interface1', 'test.desc'],
2323
['xml-interface1', 'test_wrong_flag.desc'],
2424
# these want --show-goto-functions instead of producing a trace
25+
['integer-assignments1', 'integer-typecheck.desc'],
2526
['destructors', 'compound_literal.desc'],
2627
['destructors', 'enter_lexical_block.desc'],
2728
['reachability-slice-interproc2', 'test.desc'],

src/ansi-c/c_typecast.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ c_typecastt::c_typet c_typecastt::get_c_type(
382382

383383
return get_c_type(new_type);
384384
}
385+
else if(type.id() == ID_integer)
386+
return INTEGER;
385387

386388
return OTHER;
387389
}

0 commit comments

Comments
 (0)