]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/36817 (internal compiler error: in compare_values_warnv)
authorRichard Guenther <rguenther@suse.de>
Thu, 21 Aug 2008 13:50:30 +0000 (13:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 21 Aug 2008 13:50:30 +0000 (13:50 +0000)
2008-08-21  Richard Guenther  <rguenther@suse.de>

PR middle-end/36817
* tree-chrec.c (chrec_apply): Always call chrec_fold_plus which
makes sure to produce a result of the correct type.

* gcc.c-torture/compile/pr36817.c: New testcase.

From-SVN: r139385

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr36817.c [new file with mode: 0644]
gcc/tree-chrec.c

index d766455c9bdc24fb471c122019de13d5233025da..e897d5032f05394192d2780d9a68123522460816 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-21  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/36817
+       * tree-chrec.c (chrec_apply): Always call chrec_fold_plus which
+       makes sure to produce a result of the correct type.
+
 2008-08-21  Jan Hubicka  <jh@suse.cz>
        Backport from LTO branch:
 
index 9ca95d14c3f1d1259f7b6ca23f7211c69bd2de8d..4cade5a92a0eb40324f49eb3d1cc5373506cce87 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-21  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/36817
+       * gcc.c-torture/compile/pr36817.c: New testcase.
+
 2008-08-21  Richard Guenther  <rguenther@suse.de>
 
        * gcc.dg/tree-ssa/ssa-fre-13.c: Remove XFAIL.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36817.c b/gcc/testsuite/gcc.c-torture/compile/pr36817.c
new file mode 100644 (file)
index 0000000..396f491
--- /dev/null
@@ -0,0 +1,10 @@
+void xxx()
+{
+  unsigned i;
+  unsigned *p=0;
+  for(i=0; i<4; ++i)
+    *p++=0;
+  for(i=0; i<4; ++i)
+    *p++=0;
+}
+
index 89e96fd53b68aa17b6c9a1fce050997e95ea3f9b..da359529e4c78b40cae1d1cc75dd51acb3c7eade 100644 (file)
@@ -579,8 +579,7 @@ chrec_apply (unsigned var,
       /* "{a, +, b} (x)"  ->  "a + b*x".  */
       x = chrec_convert_rhs (type, x, NULL);
       res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
-      if (!integer_zerop (CHREC_LEFT (chrec)))
-       res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
+      res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
     }
   
   else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)