File tree 1 file changed +20
-14
lines changed
1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change 18
18
#include < util/string_container.h>
19
19
20
20
#include < langapi/language_util.h>
21
+ #include < util/expr_util.h>
21
22
22
23
// / Reads a memory address and loads it into the `dest` variable.
23
24
// / Marks cell as `READ_BEFORE_WRITTEN` if cell has never been written.
@@ -345,24 +346,29 @@ void interpretert::evaluate(
345
346
}
346
347
else if (expr.type ().id () == ID_pointer)
347
348
{
348
- mp_integer i=0 ;
349
- if (expr.has_operands () && expr.op0 ().id ()==ID_address_of)
349
+ if (expr.has_operands ())
350
350
{
351
- evaluate (expr.op0 (), dest);
352
- return ;
353
- }
354
- else if (expr.has_operands () && !to_integer (expr.op0 (), i))
355
- {
356
- dest.push_back (i);
357
- return ;
351
+ const exprt &object = skip_typecast (expr.op0 ());
352
+ if (object.id () == ID_address_of)
353
+ {
354
+ evaluate (object, dest);
355
+ return ;
356
+ }
357
+ else if (const auto i = numeric_cast<mp_integer>(object))
358
+ {
359
+ dest.push_back (*i);
360
+ return ;
361
+ }
358
362
}
359
363
// check if expression is constant null pointer without operands
360
- else if (
361
- !expr.has_operands () && !to_integer (to_constant_expr (expr), i) &&
362
- i.is_zero ())
364
+ else
363
365
{
364
- dest.push_back (i);
365
- return ;
366
+ const auto i = numeric_cast<mp_integer>(expr);
367
+ if (i && i->is_zero ())
368
+ {
369
+ dest.push_back (*i);
370
+ return ;
371
+ }
366
372
}
367
373
}
368
374
else if (expr.type ().id ()==ID_floatbv)
You can’t perform that action at this time.
0 commit comments