re PR tree-optimization/82102 (ICE: Segmentation fault in /home/arnd/git/gcc/gcc...
authorRichard Biener <rguenther@suse.de>
Tue, 5 Sep 2017 08:15:21 +0000 (08:15 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 5 Sep 2017 08:15:21 +0000 (08:15 +0000)
2017-09-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/82102
* tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL.

* gcc.dg/torture/pr82102.c: New testcase.

From-SVN: r251692

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr82102.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 7a824f82a2ecb6b9080e611c3b13e5a926b4fe2e..5f60fe276908e516a50bdf1111feaf14ff8d09d3 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82102
+       * tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL.
+
 2017-09-05  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/82032
index 28691293aa6d34779af7b729bc21be34c1293f68..a21730089edaad7d8ccc721a09670c3d8c8cbd1a 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82102
+       * gcc.dg/torture/pr82102.c: New testcase.
+
 2017-09-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * testsuite/gnat.dg/array29.ad[sb]: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr82102.c b/gcc/testsuite/gcc.dg/torture/pr82102.c
new file mode 100644 (file)
index 0000000..393f8bf
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+void *a, *b;
+struct pt3_i2cbuf {
+    int num_cmds;
+} c;
+void *memcpy(void *, void *, __SIZE_TYPE__);
+void put_stop();
+void translate(struct pt3_i2cbuf *p1, int p2)
+{
+  p1->num_cmds = 0;
+  if (p2)
+    put_stop();
+}
+void pt3_i2c_master_xfer(int p1)
+{
+  translate(&c, p1);
+  memcpy(a, b, c.num_cmds);
+  for (; p1;)
+    ;
+}
index 185c19268ec0cc90649e26a08e63d3192a54e786..f6fa3bbddc0e74c6da49bb301a3dfd571352377b 100644 (file)
@@ -4860,6 +4860,7 @@ fini_eliminate (void)
        lhs = gimple_get_lhs (stmt);
 
       if (inserted_exprs
+         && lhs
          && TREE_CODE (lhs) == SSA_NAME
          && bitmap_bit_p (inserted_exprs, SSA_NAME_VERSION (lhs)))
        continue;