]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/24470 (segmentation fault in cc1plus when compiling with -O)
authorRichard Guenther <rguenther@suse.de>
Thu, 3 Nov 2005 09:30:12 +0000 (09:30 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 3 Nov 2005 09:30:12 +0000 (09:30 +0000)
2005-11-03  Richard Guenther  <rguenther@suse.de>

PR middle-end/24470
* fold-const.c (fold): Avoid running in circles if we
got some un-folded subtree.

From-SVN: r106426

gcc/ChangeLog
gcc/fold-const.c

index 57f6747c8ed4c51076b7ad2c2dc25baec8c3b571..96d584fc0df586e03c2508ec4510fe48d2924aba 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-03  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/24470
+       * fold-const.c (fold): Avoid running in circles if we
+       got some un-folded subtree.
+
 2005-10-30  Alan Modra  <amodra@bigpond.net.au>
 
        PR target/23070
index ba9031b705e94d552cd85ae3936d34b5087d3a88..d786292bff868e85cef8dc4b52490a77760135bf 100644 (file)
@@ -8142,7 +8142,12 @@ fold (tree expr)
 
          if (INTEGRAL_TYPE_P (type)
              && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
-             && TREE_CODE (arg2) == INTEGER_CST)
+             && TREE_CODE (arg2) == INTEGER_CST
+             /* ???  We somehow can end up here with
+                 (unsigned int)1 == 1 ? 1U : 2U
+                for which we won't make any progress but recurse
+                indefinitely.  Just stop here in this case.  */
+             && TREE_CODE (arg1) != INTEGER_CST)
            switch (comp_code)
              {
              case EQ_EXPR: