https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112296
--- Comment #7 from Richard Henderson <rth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > int bad1(void) { return __builtin_constant_p(global++); } ... > Joseph, Richard, do you have anything to add or remember discussions about > this semantic detail of __builtin_constant_p? Since it has been 25 years, I don't recall any specific discussions. The intended use-case at the time was more like #define macro(x) \ (__builtin_constant_p(x) \ ? inline_expression(x) \ : out_of_line_function(x)) So I would have expected side effects to have been ignored for the builtin and expanded via one of the two arms.