public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106628] New: Missed folding with COMPOUND_EXPR due to C frontend bugs Date: Mon, 15 Aug 2022 13:57:05 +0000 [thread overview] Message-ID: <bug-106628-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106628 Bug ID: 106628 Summary: Missed folding with COMPOUND_EXPR due to C frontend bugs Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- Doing diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 4f4ec81c8d4..698f115507a 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -12595,14 +12595,9 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, return NULL_TREE; case COMPOUND_EXPR: - /* When pedantic, a compound expression can be neither an lvalue - nor an integer constant expression. */ - if (TREE_SIDE_EFFECTS (arg0) || TREE_CONSTANT (arg1)) + if (TREE_SIDE_EFFECTS (arg0)) return NULL_TREE; - /* Don't let (0, 0) be null pointer constant. */ - tem = integer_zerop (arg1) ? build1_loc (loc, NOP_EXPR, type, arg1) - : fold_convert_loc (loc, type, arg1); - return tem; + return op1; case ASSERT_EXPR: /* An ASSERT_EXPR should never be passed to fold_binary. */ results in missed diagnostics: FAIL: gcc.dg/array-5.c bad vla handling (test for bogus messages, line 40) FAIL: gcc.dg/c99-const-expr-12.c (test for excess errors) FAIL: gcc.dg/pr61096-1.c (test for errors, line 29) FAIL: gcc.dg/pr61096-1.c (test for excess errors)
next reply other threads:[~2022-08-15 13:57 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-15 13:57 rguenth at gcc dot gnu.org [this message] 2022-08-15 16:04 ` [Bug c/106628] " pinskia 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-106628-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).