@@ -2056,6 +2056,8 @@ exprt c_typecheck_baset::do_special_functions(
2056
2056
throw 0 ;
2057
2057
}
2058
2058
2059
+ typecheck_function_call_arguments (expr);
2060
+
2059
2061
exprt same_object_expr=
2060
2062
same_object (expr.arguments ()[0 ], expr.arguments ()[1 ]);
2061
2063
same_object_expr.add_source_location ()=source_location;
@@ -2105,6 +2107,8 @@ exprt c_typecheck_baset::do_special_functions(
2105
2107
throw 0 ;
2106
2108
}
2107
2109
2110
+ typecheck_function_call_arguments (expr);
2111
+
2108
2112
exprt same_object_expr = is_invalid_pointer_exprt{expr.arguments ().front ()};
2109
2113
same_object_expr.add_source_location ()=source_location;
2110
2114
@@ -2119,6 +2123,8 @@ exprt c_typecheck_baset::do_special_functions(
2119
2123
throw 0 ;
2120
2124
}
2121
2125
2126
+ typecheck_function_call_arguments (expr);
2127
+
2122
2128
exprt buffer_size_expr (" buffer_size" , size_type ());
2123
2129
buffer_size_expr.operands ()=expr.arguments ();
2124
2130
buffer_size_expr.add_source_location ()=source_location;
@@ -2134,6 +2140,8 @@ exprt c_typecheck_baset::do_special_functions(
2134
2140
throw 0 ;
2135
2141
}
2136
2142
2143
+ typecheck_function_call_arguments (expr);
2144
+
2137
2145
predicate_exprt is_zero_string_expr (" is_zero_string" );
2138
2146
is_zero_string_expr.operands ()=expr.arguments ();
2139
2147
is_zero_string_expr.set (ID_C_lvalue, true ); // make it an lvalue
@@ -2150,6 +2158,8 @@ exprt c_typecheck_baset::do_special_functions(
2150
2158
throw 0 ;
2151
2159
}
2152
2160
2161
+ typecheck_function_call_arguments (expr);
2162
+
2153
2163
exprt zero_string_length_expr (" zero_string_length" , size_type ());
2154
2164
zero_string_length_expr.operands ()=expr.arguments ();
2155
2165
zero_string_length_expr.set (ID_C_lvalue, true ); // make it an lvalue
@@ -2166,6 +2176,8 @@ exprt c_typecheck_baset::do_special_functions(
2166
2176
throw 0 ;
2167
2177
}
2168
2178
2179
+ typecheck_function_call_arguments (expr);
2180
+
2169
2181
exprt is_dynamic_object_expr = is_dynamic_object_exprt (expr.arguments ()[0 ]);
2170
2182
is_dynamic_object_expr.add_source_location () = source_location;
2171
2183
@@ -2180,6 +2192,8 @@ exprt c_typecheck_baset::do_special_functions(
2180
2192
throw 0 ;
2181
2193
}
2182
2194
2195
+ typecheck_function_call_arguments (expr);
2196
+
2183
2197
exprt pointer_offset_expr=pointer_offset (expr.arguments ().front ());
2184
2198
pointer_offset_expr.add_source_location ()=source_location;
2185
2199
@@ -2194,6 +2208,8 @@ exprt c_typecheck_baset::do_special_functions(
2194
2208
throw 0 ;
2195
2209
}
2196
2210
2211
+ typecheck_function_call_arguments (expr);
2212
+
2197
2213
unary_exprt object_size_expr (
2198
2214
ID_object_size, expr.arguments ()[0 ], size_type ());
2199
2215
object_size_expr.add_source_location () = source_location;
@@ -2209,6 +2225,8 @@ exprt c_typecheck_baset::do_special_functions(
2209
2225
throw 0 ;
2210
2226
}
2211
2227
2228
+ typecheck_function_call_arguments (expr);
2229
+
2212
2230
exprt pointer_object_expr = pointer_object (expr.arguments ().front ());
2213
2231
pointer_object_expr.add_source_location () = source_location;
2214
2232
@@ -2218,15 +2236,15 @@ exprt c_typecheck_baset::do_special_functions(
2218
2236
identifier==" __builtin_bswap32" ||
2219
2237
identifier==" __builtin_bswap64" )
2220
2238
{
2221
- typecheck_function_call_arguments (expr);
2222
-
2223
2239
if (expr.arguments ().size ()!=1 )
2224
2240
{
2225
2241
error ().source_location = f_op.source_location ();
2226
2242
error () << identifier << " expects one operand" << eom;
2227
2243
throw 0 ;
2228
2244
}
2229
2245
2246
+ typecheck_function_call_arguments (expr);
2247
+
2230
2248
// these are hard-wired to 8 bits according to the gcc manual
2231
2249
bswap_exprt bswap_expr (expr.arguments ().front (), 8 , expr.type ());
2232
2250
bswap_expr.add_source_location ()=source_location;
@@ -2235,15 +2253,15 @@ exprt c_typecheck_baset::do_special_functions(
2235
2253
}
2236
2254
else if (identifier==" __builtin_nontemporal_load" )
2237
2255
{
2238
- typecheck_function_call_arguments (expr);
2239
-
2240
2256
if (expr.arguments ().size ()!=1 )
2241
2257
{
2242
2258
error ().source_location = f_op.source_location ();
2243
2259
error () << identifier << " expects one operand" << eom;
2244
2260
throw 0 ;
2245
2261
}
2246
2262
2263
+ typecheck_function_call_arguments (expr);
2264
+
2247
2265
// these return the subtype of the argument
2248
2266
exprt &ptr_arg=expr.arguments ().front ();
2249
2267
@@ -2269,6 +2287,8 @@ exprt c_typecheck_baset::do_special_functions(
2269
2287
throw 0 ;
2270
2288
}
2271
2289
2290
+ typecheck_function_call_arguments (expr);
2291
+
2272
2292
// This gets 5 integers followed by a float or double.
2273
2293
// The five integers are the return values for the cases
2274
2294
// FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL and FP_ZERO.
@@ -2315,6 +2335,8 @@ exprt c_typecheck_baset::do_special_functions(
2315
2335
throw 0 ;
2316
2336
}
2317
2337
2338
+ typecheck_function_call_arguments (expr);
2339
+
2318
2340
isnan_exprt isnan_expr (expr.arguments ().front ());
2319
2341
isnan_expr.add_source_location ()=source_location;
2320
2342
@@ -2331,6 +2353,8 @@ exprt c_typecheck_baset::do_special_functions(
2331
2353
throw 0 ;
2332
2354
}
2333
2355
2356
+ typecheck_function_call_arguments (expr);
2357
+
2334
2358
isfinite_exprt isfinite_expr (expr.arguments ().front ());
2335
2359
isfinite_expr.add_source_location ()=source_location;
2336
2360
@@ -2378,6 +2402,8 @@ exprt c_typecheck_baset::do_special_functions(
2378
2402
throw 0 ;
2379
2403
}
2380
2404
2405
+ typecheck_function_call_arguments (expr);
2406
+
2381
2407
abs_exprt abs_expr (expr.arguments ().front ());
2382
2408
abs_expr.add_source_location ()=source_location;
2383
2409
@@ -2392,6 +2418,8 @@ exprt c_typecheck_baset::do_special_functions(
2392
2418
throw 0 ;
2393
2419
}
2394
2420
2421
+ typecheck_function_call_arguments (expr);
2422
+
2395
2423
side_effect_exprt malloc_expr (ID_allocate, expr.type (), source_location);
2396
2424
malloc_expr.operands ()=expr.arguments ();
2397
2425
@@ -2407,6 +2435,8 @@ exprt c_typecheck_baset::do_special_functions(
2407
2435
throw 0 ;
2408
2436
}
2409
2437
2438
+ typecheck_function_call_arguments (expr);
2439
+
2410
2440
irep_idt id = identifier == CPROVER_PREFIX " r_ok" ? ID_r_ok : ID_w_ok;
2411
2441
2412
2442
binary_predicate_exprt ok_expr (
@@ -2427,6 +2457,8 @@ exprt c_typecheck_baset::do_special_functions(
2427
2457
throw 0 ;
2428
2458
}
2429
2459
2460
+ typecheck_function_call_arguments (expr);
2461
+
2430
2462
isinf_exprt isinf_expr (expr.arguments ().front ());
2431
2463
isinf_expr.add_source_location ()=source_location;
2432
2464
@@ -2441,6 +2473,8 @@ exprt c_typecheck_baset::do_special_functions(
2441
2473
throw 0 ;
2442
2474
}
2443
2475
2476
+ typecheck_function_call_arguments (expr);
2477
+
2444
2478
// returns 1 for +inf and -1 for -inf, and 0 otherwise
2445
2479
2446
2480
const exprt &fp_value = expr.arguments ().front ();
@@ -2468,6 +2502,8 @@ exprt c_typecheck_baset::do_special_functions(
2468
2502
throw 0 ;
2469
2503
}
2470
2504
2505
+ typecheck_function_call_arguments (expr);
2506
+
2471
2507
const exprt &fp_value = expr.arguments ()[0 ];
2472
2508
2473
2509
if (fp_value.type ().id () != ID_floatbv)
@@ -2496,6 +2532,8 @@ exprt c_typecheck_baset::do_special_functions(
2496
2532
throw 0 ;
2497
2533
}
2498
2534
2535
+ typecheck_function_call_arguments (expr);
2536
+
2499
2537
sign_exprt sign_expr (expr.arguments ().front ());
2500
2538
sign_expr.add_source_location ()=source_location;
2501
2539
@@ -2515,6 +2553,8 @@ exprt c_typecheck_baset::do_special_functions(
2515
2553
throw 0 ;
2516
2554
}
2517
2555
2556
+ typecheck_function_call_arguments (expr);
2557
+
2518
2558
popcount_exprt popcount_expr (expr.arguments ().front (), expr.type ());
2519
2559
popcount_expr.add_source_location ()=source_location;
2520
2560
@@ -2529,6 +2569,8 @@ exprt c_typecheck_baset::do_special_functions(
2529
2569
throw 0 ;
2530
2570
}
2531
2571
2572
+ typecheck_function_call_arguments (expr);
2573
+
2532
2574
equal_exprt equality_expr (
2533
2575
expr.arguments ().front (), expr.arguments ().back ());
2534
2576
equality_expr.add_source_location ()=source_location;
@@ -2557,6 +2599,8 @@ exprt c_typecheck_baset::do_special_functions(
2557
2599
throw 0 ;
2558
2600
}
2559
2601
2602
+ typecheck_function_call_arguments (expr);
2603
+
2560
2604
return typecast_exprt (expr.arguments ()[0 ], expr.type ());
2561
2605
}
2562
2606
else if (identifier==" __builtin_object_size" )
@@ -2572,6 +2616,8 @@ exprt c_typecheck_baset::do_special_functions(
2572
2616
throw 0 ;
2573
2617
}
2574
2618
2619
+ typecheck_function_call_arguments (expr);
2620
+
2575
2621
make_constant (expr.arguments ()[1 ]);
2576
2622
2577
2623
mp_integer arg1;
@@ -2614,6 +2660,8 @@ exprt c_typecheck_baset::do_special_functions(
2614
2660
throw 0 ;
2615
2661
}
2616
2662
2663
+ typecheck_function_call_arguments (expr);
2664
+
2617
2665
exprt arg0 =
2618
2666
typecast_exprt::conditional_cast (expr.arguments ()[0 ], bool_typet ());
2619
2667
make_constant (arg0);
@@ -2634,6 +2682,9 @@ exprt c_typecheck_baset::do_special_functions(
2634
2682
throw 0 ;
2635
2683
}
2636
2684
2685
+ // do not typecheck the argument - it is never evaluated, and thus side
2686
+ // effects must not show up either
2687
+
2637
2688
// try to produce constant
2638
2689
exprt tmp1=expr.arguments ().front ();
2639
2690
simplify (tmp1, *this );
@@ -2671,6 +2722,8 @@ exprt c_typecheck_baset::do_special_functions(
2671
2722
throw 0 ;
2672
2723
}
2673
2724
2725
+ typecheck_function_call_arguments (expr);
2726
+
2674
2727
exprt object=expr.arguments ()[0 ];
2675
2728
2676
2729
// The value doesn't matter at all, we only care about the type.
@@ -2743,6 +2796,8 @@ exprt c_typecheck_baset::do_special_functions(
2743
2796
throw 0 ;
2744
2797
}
2745
2798
2799
+ typecheck_function_call_arguments (expr);
2800
+
2746
2801
exprt &ptr_arg=expr.arguments ().front ();
2747
2802
2748
2803
if (ptr_arg.type ().id ()!=ID_pointer)
0 commit comments