http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56977
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> --- This is a bigger problem with glibc's open() implementation, where correct use does not just lead to a warning, but to a compile-time error. Self-contained test: __attribute__((__error__("error"))) void error (); void f (int); extern inline __attribute__((__always_inline__)) void f (int i) { if (__builtin_constant_p (i)) { error (); } } void g(int j) { f (j); } Compiling with -Og leads to: $ gcc -Og -c test.c In function ‘f’, inlined from ‘g’ at test.c:12:5: test.c:7:11: error: call to ‘error’ declared with attribute error: error error (); ^ $ gcc --version gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The if block, including the call to error(), gets removed at all optimization levels (even -O0) other than -Og.