https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26724
--- Comment #2 from Anton Blanchard <anton at samba dot org> --- This issue is still present. The workaround Andrew suggests is good: static inline int baz(void) { return 0; } void bad() { int i = baz(); if (!__builtin_constant_p(i)) FAIL(); }