@@ -2052,6 +2052,8 @@ exprt c_typecheck_baset::do_special_functions(
2052
2052
throw 0 ;
2053
2053
}
2054
2054
2055
+ typecheck_function_call_arguments (expr);
2056
+
2055
2057
exprt same_object_expr=
2056
2058
same_object (expr.arguments ()[0 ], expr.arguments ()[1 ]);
2057
2059
same_object_expr.add_source_location ()=source_location;
@@ -2101,6 +2103,8 @@ exprt c_typecheck_baset::do_special_functions(
2101
2103
throw 0 ;
2102
2104
}
2103
2105
2106
+ typecheck_function_call_arguments (expr);
2107
+
2104
2108
exprt same_object_expr = is_invalid_pointer_exprt{expr.arguments ().front ()};
2105
2109
same_object_expr.add_source_location ()=source_location;
2106
2110
@@ -2115,6 +2119,8 @@ exprt c_typecheck_baset::do_special_functions(
2115
2119
throw 0 ;
2116
2120
}
2117
2121
2122
+ typecheck_function_call_arguments (expr);
2123
+
2118
2124
exprt buffer_size_expr (" buffer_size" , size_type ());
2119
2125
buffer_size_expr.operands ()=expr.arguments ();
2120
2126
buffer_size_expr.add_source_location ()=source_location;
@@ -2130,6 +2136,8 @@ exprt c_typecheck_baset::do_special_functions(
2130
2136
throw 0 ;
2131
2137
}
2132
2138
2139
+ typecheck_function_call_arguments (expr);
2140
+
2133
2141
predicate_exprt is_zero_string_expr (" is_zero_string" );
2134
2142
is_zero_string_expr.operands ()=expr.arguments ();
2135
2143
is_zero_string_expr.set (ID_C_lvalue, true ); // make it an lvalue
@@ -2146,6 +2154,8 @@ exprt c_typecheck_baset::do_special_functions(
2146
2154
throw 0 ;
2147
2155
}
2148
2156
2157
+ typecheck_function_call_arguments (expr);
2158
+
2149
2159
exprt zero_string_length_expr (" zero_string_length" , size_type ());
2150
2160
zero_string_length_expr.operands ()=expr.arguments ();
2151
2161
zero_string_length_expr.set (ID_C_lvalue, true ); // make it an lvalue
@@ -2162,6 +2172,8 @@ exprt c_typecheck_baset::do_special_functions(
2162
2172
throw 0 ;
2163
2173
}
2164
2174
2175
+ typecheck_function_call_arguments (expr);
2176
+
2165
2177
exprt is_dynamic_object_expr = is_dynamic_object_exprt (expr.arguments ()[0 ]);
2166
2178
is_dynamic_object_expr.add_source_location () = source_location;
2167
2179
@@ -2176,6 +2188,8 @@ exprt c_typecheck_baset::do_special_functions(
2176
2188
throw 0 ;
2177
2189
}
2178
2190
2191
+ typecheck_function_call_arguments (expr);
2192
+
2179
2193
exprt pointer_offset_expr=pointer_offset (expr.arguments ().front ());
2180
2194
pointer_offset_expr.add_source_location ()=source_location;
2181
2195
@@ -2190,6 +2204,8 @@ exprt c_typecheck_baset::do_special_functions(
2190
2204
throw 0 ;
2191
2205
}
2192
2206
2207
+ typecheck_function_call_arguments (expr);
2208
+
2193
2209
unary_exprt object_size_expr (
2194
2210
ID_object_size, expr.arguments ()[0 ], size_type ());
2195
2211
object_size_expr.add_source_location () = source_location;
@@ -2205,6 +2221,8 @@ exprt c_typecheck_baset::do_special_functions(
2205
2221
throw 0 ;
2206
2222
}
2207
2223
2224
+ typecheck_function_call_arguments (expr);
2225
+
2208
2226
exprt pointer_object_expr = pointer_object (expr.arguments ().front ());
2209
2227
pointer_object_expr.add_source_location () = source_location;
2210
2228
@@ -2214,15 +2232,15 @@ exprt c_typecheck_baset::do_special_functions(
2214
2232
identifier==" __builtin_bswap32" ||
2215
2233
identifier==" __builtin_bswap64" )
2216
2234
{
2217
- typecheck_function_call_arguments (expr);
2218
-
2219
2235
if (expr.arguments ().size ()!=1 )
2220
2236
{
2221
2237
error ().source_location = f_op.source_location ();
2222
2238
error () << identifier << " expects one operand" << eom;
2223
2239
throw 0 ;
2224
2240
}
2225
2241
2242
+ typecheck_function_call_arguments (expr);
2243
+
2226
2244
// these are hard-wired to 8 bits according to the gcc manual
2227
2245
bswap_exprt bswap_expr (expr.arguments ().front (), 8 , expr.type ());
2228
2246
bswap_expr.add_source_location ()=source_location;
@@ -2231,15 +2249,15 @@ exprt c_typecheck_baset::do_special_functions(
2231
2249
}
2232
2250
else if (identifier==" __builtin_nontemporal_load" )
2233
2251
{
2234
- typecheck_function_call_arguments (expr);
2235
-
2236
2252
if (expr.arguments ().size ()!=1 )
2237
2253
{
2238
2254
error ().source_location = f_op.source_location ();
2239
2255
error () << identifier << " expects one operand" << eom;
2240
2256
throw 0 ;
2241
2257
}
2242
2258
2259
+ typecheck_function_call_arguments (expr);
2260
+
2243
2261
// these return the subtype of the argument
2244
2262
exprt &ptr_arg=expr.arguments ().front ();
2245
2263
@@ -2265,6 +2283,8 @@ exprt c_typecheck_baset::do_special_functions(
2265
2283
throw 0 ;
2266
2284
}
2267
2285
2286
+ typecheck_function_call_arguments (expr);
2287
+
2268
2288
// This gets 5 integers followed by a float or double.
2269
2289
// The five integers are the return values for the cases
2270
2290
// FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL and FP_ZERO.
@@ -2311,6 +2331,8 @@ exprt c_typecheck_baset::do_special_functions(
2311
2331
throw 0 ;
2312
2332
}
2313
2333
2334
+ typecheck_function_call_arguments (expr);
2335
+
2314
2336
isnan_exprt isnan_expr (expr.arguments ().front ());
2315
2337
isnan_expr.add_source_location ()=source_location;
2316
2338
@@ -2327,6 +2349,8 @@ exprt c_typecheck_baset::do_special_functions(
2327
2349
throw 0 ;
2328
2350
}
2329
2351
2352
+ typecheck_function_call_arguments (expr);
2353
+
2330
2354
isfinite_exprt isfinite_expr (expr.arguments ().front ());
2331
2355
isfinite_expr.add_source_location ()=source_location;
2332
2356
@@ -2374,6 +2398,8 @@ exprt c_typecheck_baset::do_special_functions(
2374
2398
throw 0 ;
2375
2399
}
2376
2400
2401
+ typecheck_function_call_arguments (expr);
2402
+
2377
2403
abs_exprt abs_expr (expr.arguments ().front ());
2378
2404
abs_expr.add_source_location ()=source_location;
2379
2405
@@ -2388,6 +2414,8 @@ exprt c_typecheck_baset::do_special_functions(
2388
2414
throw 0 ;
2389
2415
}
2390
2416
2417
+ typecheck_function_call_arguments (expr);
2418
+
2391
2419
side_effect_exprt malloc_expr (ID_allocate, expr.type (), source_location);
2392
2420
malloc_expr.operands ()=expr.arguments ();
2393
2421
@@ -2403,6 +2431,8 @@ exprt c_typecheck_baset::do_special_functions(
2403
2431
throw 0 ;
2404
2432
}
2405
2433
2434
+ typecheck_function_call_arguments (expr);
2435
+
2406
2436
irep_idt id = identifier == CPROVER_PREFIX " r_ok" ? ID_r_ok : ID_w_ok;
2407
2437
2408
2438
binary_predicate_exprt ok_expr (
@@ -2423,6 +2453,8 @@ exprt c_typecheck_baset::do_special_functions(
2423
2453
throw 0 ;
2424
2454
}
2425
2455
2456
+ typecheck_function_call_arguments (expr);
2457
+
2426
2458
isinf_exprt isinf_expr (expr.arguments ().front ());
2427
2459
isinf_expr.add_source_location ()=source_location;
2428
2460
@@ -2437,6 +2469,8 @@ exprt c_typecheck_baset::do_special_functions(
2437
2469
throw 0 ;
2438
2470
}
2439
2471
2472
+ typecheck_function_call_arguments (expr);
2473
+
2440
2474
// returns 1 for +inf and -1 for -inf, and 0 otherwise
2441
2475
2442
2476
const exprt &fp_value = expr.arguments ().front ();
@@ -2464,6 +2498,8 @@ exprt c_typecheck_baset::do_special_functions(
2464
2498
throw 0 ;
2465
2499
}
2466
2500
2501
+ typecheck_function_call_arguments (expr);
2502
+
2467
2503
const exprt &fp_value = expr.arguments ()[0 ];
2468
2504
2469
2505
if (fp_value.type ().id () != ID_floatbv)
@@ -2492,6 +2528,8 @@ exprt c_typecheck_baset::do_special_functions(
2492
2528
throw 0 ;
2493
2529
}
2494
2530
2531
+ typecheck_function_call_arguments (expr);
2532
+
2495
2533
sign_exprt sign_expr (expr.arguments ().front ());
2496
2534
sign_expr.add_source_location ()=source_location;
2497
2535
@@ -2511,6 +2549,8 @@ exprt c_typecheck_baset::do_special_functions(
2511
2549
throw 0 ;
2512
2550
}
2513
2551
2552
+ typecheck_function_call_arguments (expr);
2553
+
2514
2554
popcount_exprt popcount_expr (expr.arguments ().front (), expr.type ());
2515
2555
popcount_expr.add_source_location ()=source_location;
2516
2556
@@ -2525,6 +2565,8 @@ exprt c_typecheck_baset::do_special_functions(
2525
2565
throw 0 ;
2526
2566
}
2527
2567
2568
+ typecheck_function_call_arguments (expr);
2569
+
2528
2570
equal_exprt equality_expr (
2529
2571
expr.arguments ().front (), expr.arguments ().back ());
2530
2572
equality_expr.add_source_location ()=source_location;
@@ -2553,6 +2595,8 @@ exprt c_typecheck_baset::do_special_functions(
2553
2595
throw 0 ;
2554
2596
}
2555
2597
2598
+ typecheck_function_call_arguments (expr);
2599
+
2556
2600
return typecast_exprt (expr.arguments ()[0 ], expr.type ());
2557
2601
}
2558
2602
else if (identifier==" __builtin_object_size" )
@@ -2568,6 +2612,8 @@ exprt c_typecheck_baset::do_special_functions(
2568
2612
throw 0 ;
2569
2613
}
2570
2614
2615
+ typecheck_function_call_arguments (expr);
2616
+
2571
2617
make_constant (expr.arguments ()[1 ]);
2572
2618
2573
2619
mp_integer arg1;
@@ -2610,6 +2656,8 @@ exprt c_typecheck_baset::do_special_functions(
2610
2656
throw 0 ;
2611
2657
}
2612
2658
2659
+ typecheck_function_call_arguments (expr);
2660
+
2613
2661
exprt arg0 =
2614
2662
typecast_exprt::conditional_cast (expr.arguments ()[0 ], bool_typet ());
2615
2663
make_constant (arg0);
@@ -2630,6 +2678,9 @@ exprt c_typecheck_baset::do_special_functions(
2630
2678
throw 0 ;
2631
2679
}
2632
2680
2681
+ // do not typecheck the argument - it is never evaluated, and thus side
2682
+ // effects must not show up either
2683
+
2633
2684
// try to produce constant
2634
2685
exprt tmp1=expr.arguments ().front ();
2635
2686
simplify (tmp1, *this );
@@ -2667,6 +2718,8 @@ exprt c_typecheck_baset::do_special_functions(
2667
2718
throw 0 ;
2668
2719
}
2669
2720
2721
+ typecheck_function_call_arguments (expr);
2722
+
2670
2723
exprt object=expr.arguments ()[0 ];
2671
2724
2672
2725
// The value doesn't matter at all, we only care about the type.
@@ -2739,6 +2792,8 @@ exprt c_typecheck_baset::do_special_functions(
2739
2792
throw 0 ;
2740
2793
}
2741
2794
2795
+ typecheck_function_call_arguments (expr);
2796
+
2742
2797
exprt &ptr_arg=expr.arguments ().front ();
2743
2798
2744
2799
if (ptr_arg.type ().id ()!=ID_pointer)
0 commit comments