tree-optimization/97238 - fix typo causing ICE
authorRichard Biener <rguenther@suse.de>
Tue, 29 Sep 2020 12:38:06 +0000 (14:38 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 29 Sep 2020 12:39:49 +0000 (14:39 +0200)
This fixes a typo causing a NULL dereference.

2020-09-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97238
* tree-ssa-reassoc.c (ovce_extract_ops): Fix typo.

* gcc.dg/pr97238.c: New testcase.

gcc/testsuite/gcc.dg/pr97238.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.c

diff --git a/gcc/testsuite/gcc.dg/pr97238.c b/gcc/testsuite/gcc.dg/pr97238.c
new file mode 100644 (file)
index 0000000..746e93a
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wno-psabi -w" } */
+
+typedef int __attribute__ ((__vector_size__ (8))) V;
+int b, c, e;
+V d;
+
+V
+foo (void)
+{
+  return (b || e) | c > d | ((b || e) | c > d);
+}
index facc794cdcc0861213bf92d8223f16e9734eee3e..a2ca1713d4b50abad1700c9ea92bb814c52e7a4d 100644 (file)
@@ -3910,7 +3910,7 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type,
     return ERROR_MARK;
 
   gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (cond));
-  if (stmt == NULL
+  if (assign == NULL
       || TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) != tcc_comparison)
     return ERROR_MARK;