https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119738
Bug ID: 119738 Summary: __builtin_choose_expr(__builtin_constant_p(...), ..., ...) is sometimes incorrect Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: regis.duchesne at broadcom dot com Target Milestone: --- Compiling this code: === static inline int foo(int v) { return __builtin_constant_p(v); } int fooCaller(void) { return foo(42); } static inline int bar(int v) { return __builtin_choose_expr(__builtin_constant_p(v), 1, 0); } int barCaller(void) { return bar(42); } === with gcc 15 (targeting x86_64 or arm64) and option -O produces a barCaller function which returns 0 instead of the expected 1. (see it in action at https://godbolt.org/z/Tqb9rhfzv ). This problem might be a duplicate of bug 19449 or bug 79482, I could not tell.