[Bug c/95699] __builtin_constant_p inconsistencies
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 17 10:12:17 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95699
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see why that should be considered a bug.
All the tests are using __builtin_constant_p in a way that it wasn't designed
for, where it changes the behavior of the program whether it evaluates to 0 or
1.
The intended use of this builtin is to allow optimizations when something can
be determined to be a compile time constant and have perhaps slower fallback
that does the same thing, where e.g. the former can actually be much more
expensive if it is not compile time constant and the latter e.g. a library
call.
More information about the Gcc-bugs
mailing list