public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vbyakovl23 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/52632] New: GCC compfail on O0 Date: Tue, 20 Mar 2012 09:05:00 -0000 [thread overview] Message-ID: <bug-52632-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52632 Bug #: 52632 Summary: GCC compfail on O0 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: vbyakovl23@gmail.com Test case a.c gives following compfail when compiling with O0 gcc –O0 –c a.c a.c: In function 'foo': a.c:4:1: error: size of unnamed array is negative For higher opt level it's ok. gcc version 4.8.0 20120319 (experimental) (GCC) The failure happened because FE on –O0 replaces builtin call by zero if it is not folded. See gcc/builtins.c, fold_builtin_1(), line 10270 switch (fcode) { case BUILT_IN_CONSTANT_P: { tree val = fold_builtin_constant_p (arg0); /* Gimplification will pull the CALL_EXPR for the builtin out of an if condition. When not optimizing, we'll not CSE it back. To avoid link error types of regressions, return false now. */ if (!val && !optimize) val = integer_zero_node; return val; } It may be fixed by a patch that disabled error message in case of not optimize. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 160d393..1ba3f51 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5345,7 +5345,7 @@ grokdeclarator (const struct c_declarator *declarator, if (TREE_CODE (size) == INTEGER_CST && size_maybe_const) { constant_expression_warning (size); - if (tree_int_cst_sgn (size) < 0) + if ((pedantic || optimize) && tree_int_cst_sgn (size) < 0) { if (name) error_at (loc, "size of array %qE is negative", name);
next reply other threads:[~2012-03-20 9:01 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-20 9:05 vbyakovl23 at gmail dot com [this message] 2012-03-20 9:11 ` [Bug c/52632] " pinskia at gcc dot gnu.org 2012-03-20 10:29 ` vbyakovl23 at gmail dot com 2012-03-20 10:59 ` mikpe at it dot uu.se 2012-03-20 11:12 ` joseph at codesourcery dot com 2012-03-20 13:50 ` mikpe at it dot uu.se 2012-03-21 8:06 ` izamyatin at gmail dot com 2012-03-21 8:49 ` jakub at gcc dot gnu.org 2014-03-26 8:23 ` mpolacek at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-52632-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).