File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed
regression/cbmc-library/memcpy-06 Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change
1
+ // #include <string.h> is intentionally missing
2
+
3
+ struct c
4
+ {
5
+ };
6
+
7
+ int d ()
8
+ {
9
+ struct c e ;
10
+ memcpy (e );
11
+ }
12
+ int main ()
13
+ {
14
+ int (* h )() = d ;
15
+ h ();
16
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ function 'memcpy' is not declared
5
+ parameter "memcpy::dst" type mismatch
6
+ ^EXIT=6$
7
+ ^SIGNAL=0$
8
+ --
9
+ ^warning: ignoring
10
+ Invariant check failed
Original file line number Diff line number Diff line change @@ -1645,14 +1645,19 @@ simplify_exprt::resultt<> simplify_exprt::simplify_inequality_rhs_is_constant(
1645
1645
}
1646
1646
}
1647
1647
else if (
1648
- expr.op0 ().id () == ID_typecast &&
1649
- expr.op0 ().type ().id () == ID_pointer &&
1650
- (to_typecast_expr (expr.op0 ()).op ().type ().id () == ID_pointer ||
1651
- config.ansi_c .NULL_is_zero ))
1648
+ expr.op0 ().id () == ID_typecast && expr.op0 ().type ().id () == ID_pointer)
1652
1649
{
1650
+ exprt op = to_typecast_expr (expr.op0 ()).op ();
1651
+ if (
1652
+ op.type ().id () != ID_pointer &&
1653
+ (!config.ansi_c .NULL_is_zero || !is_number (op.type ()) ||
1654
+ op.type ().id () == ID_complex))
1655
+ {
1656
+ return unchanged (expr);
1657
+ }
1658
+
1653
1659
// (type)ptr == NULL -> ptr == NULL
1654
1660
// note that 'ptr' may be an integer
1655
- exprt op = to_typecast_expr (expr.op0 ()).op ();
1656
1661
auto new_expr = expr;
1657
1662
new_expr.op0 ().swap (op);
1658
1663
if (new_expr.op0 ().type ().id () != ID_pointer)
You can’t perform that action at this time.
0 commit comments