File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2310,6 +2310,30 @@ exprt c_typecheck_baset::do_special_functions(
2310
2310
2311
2311
return typecast_exprt::conditional_cast (isinf_expr, expr.type ());
2312
2312
}
2313
+ else if (identifier == " __builtin_isinf_sign" )
2314
+ {
2315
+ if (expr.arguments ().size () != 1 )
2316
+ {
2317
+ err_location (f_op);
2318
+ error () << identifier << " expects one operand" << eom;
2319
+ throw 0 ;
2320
+ }
2321
+
2322
+ // returns 1 for +inf and -1 for -inf, and 0 otherwise
2323
+
2324
+ const exprt &fp_value = expr.arguments ().front ();
2325
+
2326
+ isinf_exprt isinf_expr (fp_value);
2327
+ isinf_expr.add_source_location () = source_location;
2328
+
2329
+ return if_exprt (
2330
+ isinf_exprt (fp_value),
2331
+ if_exprt (
2332
+ sign_exprt (fp_value),
2333
+ from_integer (-1 , expr.type ()),
2334
+ from_integer (1 , expr.type ())),
2335
+ from_integer (0 , expr.type ()));
2336
+ }
2313
2337
else if (identifier==CPROVER_PREFIX " isnormalf" ||
2314
2338
identifier==CPROVER_PREFIX " isnormald" ||
2315
2339
identifier==CPROVER_PREFIX " isnormalld" ||
You can’t perform that action at this time.
0 commit comments