This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36817] [4.3 Regression] internal compiler error: in compare_values_warnv
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Aug 2008 13:48:30 -0000
- Subject: [Bug middle-end/36817] [4.3 Regression] internal compiler error: in compare_values_warnv
- References: <bug-36817-4888@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from rguenther at suse dot de 2008-08-21 13:48 -------
Subject: [PATCH] Fix PR36817
On Thu, 21 Aug 2008, cnstar9988 at gmail dot com wrote:
> I am sorry for wrong test for 4.3.0.
>
> =================================================
> I rebuild my gcc 4.3.0 on 2.6.9-42.7AXsmp with gmp 4.2.3 + mpfr 2.3.1.
>
> And make a test again. It works fail.
> But the following code well on gcc 4.3.2-RC1.
> =================================================
> void xxx()
> {
> unsigned i;
> unsigned*p=2; /* 2 is ok, but failed with 0 */
> for(i=0;i<4;++i)
> {
> *p++=0;
> }
> for(i=0;i<4;++i)
> {
> *p++=0;
> }
> }
The following fix makes it obvious that _only_ pointer(!) induction
variables with zero(!) base are affected - thus I think this can
wait until after 4.3.2.
Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll apply it
to the trunk in a moment where this issue is latent.
Richard.
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.
Index: gcc/tree-chrec.c
===================================================================
*** gcc/tree-chrec.c (revision 139376)
--- gcc/tree-chrec.c (working copy)
*************** chrec_apply (unsigned var,
*** 579,586 ****
/* "{a, +, b} (x)" -> "a + b*x". */
x = chrec_convert_rhs (type, x, NULL_TREE);
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);
}
else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
--- 579,585 ----
/* "{a, +, b} (x)" -> "a + b*x". */
x = chrec_convert_rhs (type, x, NULL_TREE);
res = chrec_fold_multiply (TREE_TYPE (x), CHREC_RIGHT (chrec), x);
! res = chrec_fold_plus (type, CHREC_LEFT (chrec), res);
}
else if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
Index: gcc/testsuite/gcc.c-torture/compile/pr36817.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr36817.c (revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr36817.c (revision 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;
+ }
+
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36817