This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
- From: "harald at gigawatt dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 15 Jun 2013 09:59:12 +0000
- Subject: [Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'
- Auto-submitted: auto-generated
- References: <bug-56977-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56977
--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
Inlining isn't relevant:
__attribute__((__error__("error"))) void error ();
void f (int i) {
if (__builtin_constant_p (i)) {
error ();
}
}
fails the same way. But it doesn't fail with all uses of __builtin_constant_p:
__attribute__((__error__("error"))) void error ();
void f () {
int g ();
if (!__builtin_constant_p (1)) {
error ();
}
if (__builtin_constant_p (g ())) {
error ();
}
}
compiles without any problems.