cil icon indicating copy to clipboard operation
cil copied to clipboard

Add missing `_builtin`s

Open michael-schwarz opened this issue 2 years ago • 1 comments

Some __builitns were identiefied as missing during https://github.com/goblint/analyzer/pull/528. These should be added to CIL.

michael-schwarz avatar Jan 19 '22 10:01 michael-schwarz

The Concrat benchmarks were merged with Goblint CIL 1.8.2 and contain some builtin declarations with missing prototypes:

  • [ ] __builtin_isnan
  • [ ] __builtin_isinf_sign
  • [ ] __builtin_signbit

I thought I'd just add them, but it's not so easy it seems. https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html doesn't specify them with argument types, just as behaving like the C standard ones. But the C standard versions aren't functions but macros. This is because the same function has to work for float, double and long double without the function being suffixed. This might even be the reason why these builtins haven't been specified a long time ago in CIL.

Clang internally has its own special Floating type to represent it: https://github.com/llvm/llvm-project/blob/ce9077fe7f0ceb2800076aa1abb472de5df41f16/clang/lib/AST/Interp/InterpBuiltin.cpp#L294-L296.

sim642 avatar Oct 10 '23 08:10 sim642