public inbox for
 help / color / mirror / Atom feed
From: Peter Bergner <>
To: GCC Patches <>
Cc: Richard Biener <>,
	       Markus Trippelsdorf <>,
	       Bill Schmidt <>
Subject: [PATCH] Fix PR middle-end/80823, ICE: verify_flow_info failed
Date: Tue, 23 May 2017 17:53:00 -0000	[thread overview]
Message-ID: <> (raw)

The fix for PR80775 included a thinko bug that caused us to skip some
case label statements.  This leads to problems for test cases where we
have multiple case labels that point to the same unreachable block, but
are not mergeable since they don't have consecutive case values.
This leads to a problem, because we remove the unreachable block when
handling this first case label, but then we have a dangling reference
to that block with the skipped case label.  The fix is to remove the
unwanted increment, so that we handle the next case label and end up
removing it too.

This passed bootstrap and regtesting on powerpc64le-linux with no
regressions.  Is this ok for trunk?


	PR middle-end/80823
	* tree-cfg.c (group_case_labels_stmt): Delete increment of "i";

	PR middle-end/80823
	* gcc.dg/pr80823.c: New test.

Index: gcc/tree-cfg.c
--- gcc/tree-cfg.c	(revision 248375)
+++ gcc/tree-cfg.c	(working copy)
@@ -1726,7 +1726,6 @@ group_case_labels_stmt (gswitch *stmt)
 	    remove_edge_and_dominated_blocks (base_edge);
 	  gimple_switch_set_label (stmt, base_index, NULL_TREE);
-	  i++;
Index: gcc/testsuite/gcc.dg/pr80823.c
--- gcc/testsuite/gcc.dg/pr80823.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr80823.c	(working copy)
@@ -0,0 +1,23 @@
+/* PR middle-end/80823 ICE: verify_flow_info failed  */
+/* { dg-do compile }  */
+/* { dg-options "-O3" }  */
+int a, c;
+int b[1];
+static inline int
+fn1() {
+  switch (a)
+  case 0:
+  case 2:
+    return 1;
+  return 0;
+void fn2() {
+  int i;
+  for (;; ++i) {
+    c = b[i];
+    int d = !fn1();
+    if (d)
+      __asm__("");
+  }

             reply	other threads:[~2017-05-23 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 17:53 Peter Bergner [this message]
2017-05-24  7:18 ` Richard Biener
2017-05-24 13:09   ` Peter Bergner

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be 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).