File tree 4 files changed +5
-6
lines changed
4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -537,8 +537,7 @@ void c_typecastt::implicit_typecast_followed(
537
537
src_type.id ()==ID_natural ||
538
538
src_type.id ()==ID_integer))
539
539
{
540
- expr=exprt (ID_constant, orig_dest_type);
541
- expr.set (ID_value, ID_NULL);
540
+ expr = null_pointer_exprt{to_pointer_type (orig_dest_type)};
542
541
return ; // ok
543
542
}
544
543
Original file line number Diff line number Diff line change @@ -1382,14 +1382,14 @@ void c_typecheck_baset::typecheck_expr_rel(
1382
1382
if (type0.id ()==ID_pointer &&
1383
1383
simplify_expr (op1, *this ).is_zero ())
1384
1384
{
1385
- op1= constant_exprt (ID_NULL, type0);
1385
+ op1 = null_pointer_exprt{ to_pointer_type ( type0)} ;
1386
1386
return ;
1387
1387
}
1388
1388
1389
1389
if (type1.id ()==ID_pointer &&
1390
1390
simplify_expr (op0, *this ).is_zero ())
1391
1391
{
1392
- op0= constant_exprt (ID_NULL, type1);
1392
+ op0 = null_pointer_exprt{ to_pointer_type ( type1)} ;
1393
1393
return ;
1394
1394
}
1395
1395
Original file line number Diff line number Diff line change @@ -6743,7 +6743,7 @@ bool Parser::rPrimaryExpr(exprt &exp)
6743
6743
case TOK_NULLPTR:
6744
6744
lex.get_token (tk);
6745
6745
// as an exception, we set the width of pointer
6746
- exp = constant_exprt (ID_NULL, pointer_type (typet (ID_nullptr))) ;
6746
+ exp = null_pointer_exprt{ pointer_type (typet (ID_nullptr))} ;
6747
6747
set_location (exp , tk);
6748
6748
#ifdef DEBUG
6749
6749
std::cout << std::string (__indent, ' ' ) << " Parser::rPrimaryExpr 6\n " ;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ SCENARIO("interpreter evaluation null pointer expressions")
46
46
unsignedbv_typet java_char (16 );
47
47
pointer_typet pointer_type (java_char, 64 );
48
48
49
- constant_exprt constant_expr (ID_NULL, pointer_type) ;
49
+ null_pointer_exprt constant_expr{ pointer_type} ;
50
50
51
51
mp_vectort mp_vector = interpreter_test.evaluate (constant_expr);
52
52
You can’t perform that action at this time.
0 commit comments