GENERIC code-path checking TREE_SIDE_EFFECTS ICEs on NULL ops
(obviously).  Guard against that.

Bootstrapped on x86_64-unknown-linux-gnu, applied.

Richard.

2014-07-15  Richard Biener  <rguent...@suse.de>

        * genmatch.c (decision_tree::gen_generic): Guard against
        NULL_TREE operands.

Index: genmatch.c
===================================================================
--- genmatch.c  (revision 212545)
+++ genmatch.c  (working copy)
@@ -1614,9 +1614,9 @@ decision_tree::gen_generic (FILE *f)
         principle we can do that automagically for a subset of
         transforms (and only reject the remaining cases).
         This fixes for example gcc.c-torture/execute/20050131-1.c.  */
-      fprintf (f, "if (TREE_SIDE_EFFECTS (op0)");
+      fprintf (f, "if ((op0 && TREE_SIDE_EFFECTS (op0))");
       for (unsigned i = 1; i < n; ++i)
-       fprintf (f, "|| TREE_SIDE_EFFECTS (op%d)", i);
+       fprintf (f, "|| (op%d && TREE_SIDE_EFFECTS (op%d))", i, i);
       fprintf (f, ")\n"
               "  return NULL_TREE;\n");
 

Reply via email to