[Bug tree-optimization/126536] [13/14/15/16/17 Regression] ICE with -funswitch-loops

amacleod at redhat dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126536

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
if invert() fails to produce a valid value and returns false now, is this the
correct fix to check the return value?  I drew it from the next variation of
unswitch_predicate, but don't know the code.  

Or is there something else that should be done?


--- a/gcc/tree-ssa-loop-unswitch.cc
+++ b/gcc/tree-ssa-loop-unswitch.cc
@@ -116,7 +116,13 @@ struct unswitch_predicate
     false_range = true_range;
     if (!false_range.varying_p ()
        && !false_range.undefined_p ())
-      false_range.invert ();
+      {
+       if (!false_range.invert ())
+         {
+           true_range.set_varying (TREE_TYPE (lhs));
+           false_range.set_varying (TREE_TYPE (lhs));
+         }
+      }
     count = e->count ();
     num = predicates->length ();
     predicates->safe_push (this);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.