[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 Georg-Johann Lay changed: What|Removed |Added Keywords||documentation --- Comment #10 from G

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #9 from Georg-Johann Lay --- When this PR won't be fixed, then maybe at least the documentation could clarify how to port macros to inline functions.

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #8 from Richard Biener --- I tried removing the TREE_SIDE_EFFECTS check at some point and it had quite some fallout even in the testsuite. Don't remember the PR I tried this for ...

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 Jan Hubicka changed: What|Removed |Added CC||hubicka at gcc dot gnu.org --- Comment #7

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #6 from Georg-Johann Lay --- Recognizing more __builtin_constant_p situations is a good thing, IMO. It would allow to transition from macros to inline functions in such situations, for example in inline asm that has extra opcodes fo

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #5 from Jakub Jelinek --- It isn't about side-effects. It is about it having pointer type. If you change your testcase to uintptr_t psfr_int = (uintptr_t) psfr; if (! __builtin_constant_p (psfr_int)) then it will

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #4 from Georg-Johann Lay --- As far as I understand, & SFR has no side effects. But when it is used as argument to an (inline) function, then it does have side effects?

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #3 from Jakub Jelinek --- But in that case the POINTER_TYPE_P case doesn't trigger, because it is INTEGER_CST and so /* If we know this is a constant, emit the constant of one. */ if (CONSTANT_CLASS_P (arg) || (TREE_CODE (

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 --- Comment #2 from Georg-Johann Lay --- Notice that when &SFR is used directly in __builtin_constant_p without an inline function, then the code works as expected: int main (void) { if (__builtin_constant_p (& SFR)) __asm (".warnin

[Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions

2024-04-19 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #1