From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14254 invoked by alias); 21 Aug 2008 13:49:54 -0000 Received: (qmail 12319 invoked by alias); 21 Aug 2008 13:48:30 -0000 Date: Thu, 21 Aug 2008 13:49:00 -0000 Message-ID: <20080821134830.12318.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/36817] [4.3 Regression] internal compiler error: in compare_values_warnv In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenther at suse dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg01525.txt.bz2 ------- 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 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