Fix ICE in dump_pred_graph
authorMarek Polacek <polacek@redhat.com>
Mon, 2 May 2016 07:42:06 +0000 (07:42 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Mon, 2 May 2016 07:42:06 +0000 (07:42 +0000)
2016-05-02  Marek Polacek  <polacek@redhat.com>
    Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/70700
* tree-ssa-structalias.c (dump_pred_graph): Fix getting varinfo for ids
bigger than FIRST_REF_NODE.

* gcc.dg/pr70700.c: New test.

Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r235700

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr70700.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index e88ca467c5966d667fae80dfc89e7e2762d5f645..b2a7a2389181d78153b9e14254308a6d5a9b2702 100644 (file)
@@ -1,3 +1,10 @@
+2016-05-02  Marek Polacek  <polacek@redhat.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/70700
+       * tree-ssa-structalias.c (dump_pred_graph): Fix getting varinfo for ids
+       bigger than FIRST_REF_NODE.
+
 2016-05-02  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/52898
index cee09bc125101fb9fcdef763d45bb936c18ce78f..c4f45fa8b6c2028aa12c060e50936d74f5fad63b 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-02  Marek Polacek  <polacek@redhat.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/70700
+       * gcc.dg/pr70700.c: New test.
+
 2016-05-01  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/avx256-unaligned-load-1.c: Update scan strings.
diff --git a/gcc/testsuite/gcc.dg/pr70700.c b/gcc/testsuite/gcc.dg/pr70700.c
new file mode 100644 (file)
index 0000000..613cd29
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-ealias-graph" } */
+
+struct S
+{
+  long m;
+};
+
+struct S
+fn1 (struct S *a)
+{
+  if (a->m)
+    a->m |= 2;
+  return *a;
+}
index 0a4149489a9e8687a3c91923b9adc50484931e85..d66bdfa94ce52667c555076fd3271af08debfce5 100644 (file)
@@ -2241,7 +2241,11 @@ dump_pred_graph (struct scc_info *si, FILE *file)
       if (graph->points_to[i]
          && !bitmap_empty_p (graph->points_to[i]))
        {
-         fprintf (file, "[label=\"%s = {", get_varinfo (i)->name);
+         if (i < FIRST_REF_NODE)
+           fprintf (file, "[label=\"%s = {", get_varinfo (i)->name);
+         else
+           fprintf (file, "[label=\"*%s = {",
+                    get_varinfo (i - FIRST_REF_NODE)->name);
          unsigned j;
          bitmap_iterator bi;
          EXECUTE_IF_SET_IN_BITMAP (graph->points_to[i], 0, j, bi)