Bug 49344 - ICE in tree-flow-inline.h:745 while bootstrap
Summary: ICE in tree-flow-inline.h:745 while bootstrap
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 13:54 UTC by revital.eres
Modified: 2011-06-10 12:19 UTC (History)
3 users (show)

See Also:
Host:
Target: ppc*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-09 14:41:57


Attachments
preprocessed file strtod.i (4.91 KB, text/plain)
2011-06-09 14:42 UTC, Dominique d'Humieres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description revital.eres 2011-06-09 13:54:32 UTC
I get the following error while bootstrap -r174840 on ppc64-redhat-linux with the config file and -O2 flag:

 ../gcc/configure --prefix=/home/eres/mainline/build --enable-checking --enable-bootstrap --enable-languages=java

libtool: compile:  /home/eres/mainline/build/./gcc/xgcc -B/home/eres/mainline/build/./gcc/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/bin/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/lib/ -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/include -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/sys-include -m32 -fPIC -mstrict-align -DHAVE_CONFIG_H -I. -I../../../../../../../gcc/libjava/classpath/native/fdlibm -I../../include -fexceptions -fasynchronous-unwind-tables -g -O2 -m32 -fPIC -mstrict-align -MT w_asin.lo -MD -MP -MF .deps/w_asin.Tpo -c ../../../../../../../gcc/libjava/classpath/native/fdlibm/w_asin.c  -fPIC -DPIC -o .libs/w_asin.o
libtool: compile:  /home/eres/mainline/build/./gcc/xgcc -B/home/eres/mainline/build/./gcc/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/bin/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/lib/ -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/include -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/sys-include -m32 -fPIC -mstrict-align -DHAVE_CONFIG_H -I. -I../../../../../../../gcc/libjava/classpath/native/fdlibm -I../../include -fexceptions -fasynchronous-unwind-tables -g -O2 -m32 -fPIC -mstrict-align -MT w_acos.lo -MD -MP -MF .deps/w_acos.Tpo -c ../../../../../../../gcc/libjava/classpath/native/fdlibm/w_acos.c  -fPIC -DPIC -o .libs/w_acos.o
libtool: compile:  /home/eres/mainline/build/./gcc/xgcc -B/home/eres/mainline/build/./gcc/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/bin/ -B/home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/lib/ -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/include -isystem /home/eres/mainline/build/powerpc64-unknown-linux-gnu/32/sys-include -m32 -fPIC -mstrict-align -DHAVE_CONFIG_H -I. -I../../../../../../../gcc/libjava/classpath/native/fdlibm -I../../include -fexceptions -fasynchronous-unwind-tables -g -O2 -m32 -fPIC -mstrict-align -MT w_atan2.lo -MD -MP -MF .deps/w_atan2.Tpo -c ../../../../../../../gcc/libjava/classpath/native/fdlibm/w_atan2.c  -fPIC -DPIC -o .libs/w_atan2.o
../../../../../../../gcc/libjava/classpath/native/fdlibm/strtod.c: In function ג_Jv_strtod_rג:
../../../../../../../gcc/libjava/classpath/native/fdlibm/strtod.c:106:1: internal compiler error: in op_iter_init, at tree-flow-inline.h:745
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[7]: *** [strtod.lo] Error 1
Comment 1 Dominique d'Humieres 2011-06-09 14:41:57 UTC
Confirmed on powerpc-apple-darwin* (see http://gcc.gnu.org/regtest/HEAD/native-lastbuild.txt.gzip).
I'll attach the preprocessed file strtod.i. The backtrace of

/opt/gcc/darwin_buildw/gcc/cc1 -O2 -g strtod.i

(-m32 default) is

#0  fancy_abort (file=0x9a4664 "../../work/gcc/tree-flow-inline.h", line=745, function=0xb886e4 "op_iter_init") at ../../work/gcc/diagnostic.c:893
#1  0x007a4570 in op_iter_init () at tree-flow-inline.h:743
#2  0x007ac974 in convert_mult_to_fma (mul_stmt=0xcf08bc, op1=0xd12e70, op2=0x41fa8bd0) at ../../work/gcc/tree-ssa-math-opts.c:2132
#3  0x007acd4c in execute_optimize_widening_mul () at ../../work/gcc/tree-ssa-math-opts.c:2319
#4  0x005b3d24 in execute_one_pass (pass=0xbbefd4) at ../../work/gcc/passes.c:1899
#5  0x005b40b8 in execute_pass_list (pass=0xc00000) at ../../work/gcc/passes.c:1953
#6  execute_pass_list (pass=0xbbe850) at ../../work/gcc/passes.c:1955
#7  0x00703088 in tree_rest_of_compilation (fndecl=0x41fc5480) at ../../work/gcc/tree-optimize.c:417
#8  0x0029dde0 in cgraph_expand_function (node=0x41fab1f8) at ../../work/gcc/cgraphunit.c:1635
#9  0x0029fe08 in cgraph_optimize () at ../../work/gcc/cgraphunit.c:1694
#10 0x002a052c in cgraph_finalize_compilation_unit () at ../../work/gcc/cgraphunit.c:1131
#11 0x000200ec in c_write_global_declarations () at ../../work/gcc/c-decl.c:9844
#12 0x0067ae54 in toplev_main (argc=3, argv=0x0) at ../../work/gcc/toplev.c:586
#13 0x00001ca0 in start ()

According http://gcc.gnu.org/ml/gcc-regression/2011-06/msg00099.html, the failure occurred between revisions 174833 and 174836.
Comment 2 Dominique d'Humieres 2011-06-09 14:42:37 UTC
Created attachment 24476 [details]
preprocessed file strtod.i
Comment 3 Richard Biener 2011-06-09 15:13:18 UTC
Sounds a bit strange.  It must be (my tree doesn't match the lines exactly):

          /* Make sure the negate statement becomes dead with this
             single transformation.  */
          if (!single_imm_use (gimple_assign_lhs (use_stmt),
                               &use_p, &neguse_stmt))
            return false;

          /* Make sure the multiplication isn't also used on that stmt.  */
          FOR_EACH_SSA_TREE_OPERAND (use, neguse_stmt, iter, SSA_OP_USE)
            if (use == mul_result)
              return false;

"guessed patch":

Index: gcc/tree-ssa-math-opts.c
===================================================================
--- gcc/tree-ssa-math-opts.c    (revision 174845)
+++ gcc/tree-ssa-math-opts.c    (working copy)
@@ -2174,7 +2174,7 @@ convert_mult_to_fma (gimple mul_stmt, tr
       if (use_code == NEGATE_EXPR)
        {
          ssa_op_iter iter;
-         tree use;
+         use_operand_p usep;
 
          result = gimple_assign_lhs (use_stmt);
 
@@ -2185,8 +2185,8 @@ convert_mult_to_fma (gimple mul_stmt, tr
            return false;
 
          /* Make sure the multiplication isn't also used on that stmt.  */
-         FOR_EACH_SSA_TREE_OPERAND (use, neguse_stmt, iter, SSA_OP_USE)
-           if (use == mul_result)
+         FOR_EACH_PHI_OR_STMT_USE (usep, neguse_stmt, iter, SSA_OP_USE)
+           if (USE_FROM_PTR (usep) == mul_result)
              return false;
 
          /* Re-validate.  */
Comment 4 Dominique d'Humieres 2011-06-09 15:15:00 UTC
CCed Andi Kleen (BTW Andi could you update your email address in MAINTAINERS? TIA).
Comment 5 Andi Kleen 2011-06-09 16:06:34 UTC
Hmm, it's hard to see how my patch could have caused this.
It doesn't really change any RTL.

Does the test case even use global registers?

I don't see any in native/fdlibm/strtod.c

The only thing that could possibly have a side effect is storing
the decl in a global array, but even that should be benign.

Are you sure you bisected right?
Comment 6 Dominique d'Humieres 2011-06-09 16:32:47 UTC
> Are you sure you bisected right?

I should have looked at http://gcc.gnu.org/ml/gcc-regression/2011-06/msg00092.html where the range is given by

> With your recent patch, GCC HEAD revision 174833 had problems on:
> native: build (NEW build failure)
> Attached is build output for those targets.
> The previous build was of revision 174812.

Sorry about that.
Comment 7 Pat Haugen 2011-06-09 18:44:29 UTC
Four cpu2000 benchmarks (eon,fma3d,sixtrack,apsi) also fail to build with the same ICE starting with the following revision.

------------------------------------------------------------------------
r174815 | aoliva | 2011-06-08 14:39:12 -0500 (Wed, 08 Jun 2011) | 4 lines

* tree-flow-inline.h (op_iter_init): Reject GIMPLE_PHI stmts.
(num_ssa_operands): Likewise.
(op_iter_init_phiuse): Forward-declare.
(delink_stmt_imm_use): Iterate with FOR_EACH_PHI_OR_STMT_USE.
Comment 8 Dominique d'Humieres 2011-06-10 08:32:37 UTC
With the patch in comment #3 applied on top of revision 174846 I have been able to update powerpc-apple-darwin9 (long update, but not a full bootstrap).
Comment 9 Richard Biener 2011-06-10 11:08:09 UTC
Well, I'm going to test and install it.
Comment 10 Richard Biener 2011-06-10 12:18:59 UTC
Author: rguenth
Date: Fri Jun 10 12:18:55 2011
New Revision: 174902

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174902
Log:
2011-06-10  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/49344
	* tree-ssa-math-opts.c (convert_mult_to_fma): Use
	FOR_EACH_PHI_OR_STMT_USE.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-math-opts.c
Comment 11 Richard Biener 2011-06-10 12:19:41 UTC
Fixed.