https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84607
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Status|UNCONFIRMED |ASSIGNED
Known to work| |5.5.0
Keywords| |wrong-code
Last reconfirmed| |2018-02-28
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot
gnu.org
Ever confirmed|0 |1
Summary|Side effects discarded in |[6/7/8 Regression] Side
|address computation inside |effects discarded in
|'if' |address computation inside
| |'if'
Target Milestone|--- |6.5
Known to fail| |6.1.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. Note the same issue happens when using the C++ frontend. IL
difference between 5.5 and 6.1:
--- t.c.003t.original 2018-02-28 09:47:04.783058082 +0100
+++ t.c.003t.original.6 2018-02-28 09:46:55.318915245 +0100
@@ -14,7 +14,7 @@
{
- if (&a[foo ()];, 1)
+ if (1)
{
puts ((const char *) "goodbye");
}
so it looks like some folding issue.
Triggered by
(simplify
(cmp (convert? addr@0) integer_zerop)
(if (tree_single_nonzero_warnv_p (@0, NULL))
{ constant_boolean_node (cmp == NE_EXPR, type); })))
which implements itself as
8294 /* #line 3553 "/space/rguenther/src/svn/early-lto-debug/gcc/match.pd"
*/
8295 if (tree_single_nonzero_warnv_p (captures[0], NULL))
8296 {
8297 if (TREE_SIDE_EFFECTS (op1)) return NULL_TREE;
^^^ this should have checked op0!
8298 if (dump_file && (dump_flags & TDF_FOLDING)) fprintf (dump_file,
"Applying pattern match.pd:3554, %s:%d\n", __FILE__, __LINE__);
8299 tree res;
8300 res = constant_boolean_node (cmp == NE_EXPR, type);
8301 return res;