On 05/21/2011 09:40 AM, Eric Botcazou wrote: >> 2011-05-05 Tom de Vries <t...@codesourcery.com> >> >> PR target/45098 >> * tree-ssa-loop-ivopts.c: Include expmed.h. >> (get_shiftadd_cost): New function. >> (force_expr_to_var_cost): Declare forward. Use get_shiftadd_cost. > > This breaks the Ada compiler on x86: > > /home/eric/build/gcc/native32/./gcc/xgcc > -B/home/eric/build/gcc/native32/./gcc/ > -B/home/eric/install/gcc/i586-suse-linux/bin/ > -B/home/eric/install/gcc/i586-suse-linux/lib/ -isystem > /home/eric/install/gcc/i586-suse-linux/include -isystem > /home/eric/install/gcc/i586-suse-linux/sys-include -c -g -O2 -fPIC -W > -Wall -gnatpg > a-calend.adb -o a-calend.o > +===========================GNAT BUG DETECTED==============================+ > | 4.7.0 20110521 (experimental) [trunk revision 173887] (i586-suse-linux-gnu) > GCC error:| > | in int_cst_value, at tree.c:9970 | > | Error detected around a-calend.adb:1254:7 > > To reproduce, do: > gcc/gnat1 gcc/ada/rts/a-calend.adb -gnatg -O -Igcc/ada/rts > in the build dir. >
I didn't manage to reproduce the breakage, but I think this patch will fix it. The patch makes sure cst_and_fits_in_hwi is tested before using int_cst_value. Regtested on x86_64. Ok for trunk? 2011-05-22 Tom de Vries <t...@codesourcery.com> PR target/45098 * tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Fixed const test for call to get_shiftadd_cost.
Index: gcc/tree-ssa-loop-ivopts.c =================================================================== --- gcc/tree-ssa-loop-ivopts.c (revision 173703) +++ gcc/tree-ssa-loop-ivopts.c (working copy) @@ -3683,7 +3683,7 @@ mult = op0; if (mult != NULL_TREE - && TREE_CODE (TREE_OPERAND (mult, 1)) == INTEGER_CST + && cst_and_fits_in_hwi (TREE_OPERAND (mult, 1)) && get_shiftadd_cost (expr, mode, cost0, cost1, mult, speed, &sa_cost)) return sa_cost;