On June 28th, the powerpc bootstrap was broken due to changes to expmed.c. The bootstrap dies when compiling libgcc.a as mentioned in: http://gcc.gnu.org/ml/gcc-patches/2009-06/msg02180.html emit_store_flag gets a GT test that it tries to convert to LE. Inside the recursive call, it then tries to convert the LE back to a GT test. Eventually the compiler runs out of stack space and dies.
Mine of course. I was going to post the patch to the mailing list after it was well into my x86_64-linux bootstrap, I'll add it here. Thanks for the testcase BTW.
Created attachment 18096 [details] patch currently in stage2 Here it is. A bit early for posting to gcc-patches, but if you want to approve it I'll commit it tomorrow morning, after making sure the bootstrap/regtest passes.
Created attachment 18097 [details] Proposed patch to fix the problem This patch allows the powerpc64-gnu-linux system to boostrap once again.
Subject: Re: Powerpc bootstrap is broken due to changes in expmed.c On Mon, Jun 29, 2009 at 09:34:02PM -0000, bonzini at gnu dot org wrote: > > > ------- Comment #2 from bonzini at gnu dot org 2009-06-29 21:34 ------- > Created an attachment (id=18096) > --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18096&action=view) > patch currently in stage2 > > Here it is. A bit early for posting to gcc-patches, but if you want to approve > it I'll commit it tomorrow morning, after making sure the bootstrap/regtest > passes. > > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40597 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. Approved assuming it passes bootstrap/regtest.
Subject: Re: Powerpc bootstrap is broken due to changes in expmed.c On Mon, Jun 29, 2009 at 09:32:47PM -0000, bonzini at gnu dot org wrote: > > > ------- Comment #1 from bonzini at gnu dot org 2009-06-29 21:32 ------- > Mine of course. I was going to post the patch to the mailing list after it was > well into my x86_64-linux bootstrap, I'll add it here. > > Thanks for the testcase BTW. > > > -- > > bonzini at gnu dot org changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > AssignedTo|unassigned at gcc dot gnu |bonzini at gnu dot org > |dot org | > Status|UNCONFIRMED |ASSIGNED > Ever Confirmed|0 |1 > Last reconfirmed|0000-00-00 00:00:00 |2009-06-29 21:32:47 > date| | > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40597 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. With my patch, I get 4 regressions compared to the sources I snapped on Friday (subversion #148954): gcc.c-torture/execute/20071030-1.c gcc.c-torture/compile/pr37258.c gfortran.dg/negative_unit_int8.f gfortran.fortran-torture/execute/inquire_5.f90 On the other hand, I get one pass that used to fail: gfortran.dg/proc_ptr_result_1.f90
Subject: Bug 40597 Author: bonzini Date: Tue Jun 30 07:59:01 2009 New Revision: 149083 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149083 Log: 2009-06-30 Paolo Bonzini <bonzini@gnu.org> PR boostrap/40597 * expmed.c (emit_cstore): New name of emit_store_flag_1. (emit_store_flag_1): Extract from emit_store_flag, adjust calls to (what now is) emit_cstore. (emit_store_flag): Call emit_store_flag_1 and also use it for what used to be recursive calls. Modified: trunk/gcc/ChangeLog trunk/gcc/expmed.c
The bootstrap was successful on x86_64-linux, I'll look at the failures tonight.
Now I see failures when building libgcc: ../../.././gcc/dp-bit.c: In function '__pack_d': ../../.././gcc/dp-bit.c:268:39: internal compiler error: in simplify_subreg, at simplify-rtx.c:4966
The traceback leads to the store flag change. (gdb) print op $3 = (rtx) 0x30153558 (gdb) pr (reg:SI 234) (gdb) print innermode $4 = DImode (gdb) print outermode $5 = SImode #0 fancy_abort (file=0x10e8a5b8 "/farm/dje/src/src/gcc/simplify-rtx.c", line=4966, function=0x10e8a7b8 "simplify_subreg") at /farm/dje/src/src/gcc/diagnostic.c:730 #1 0x105d4920 in simplify_subreg (outermode=SImode, op=0x30153558, innermode=DImode, byte=0) at /farm/dje/src/src/gcc/simplify-rtx.c:4965 #2 0x105d6204 in simplify_gen_subreg (outermode=SImode, op=0x30153558, innermode=DImode, byte=0) at /farm/dje/src/src/gcc/simplify-rtx.c:5273 #3 0x1012a0ac in operand_subword (op=0x30153558, offset=0, validate_address=1, mode=DImode) at /farm/dje/src/src/gcc/emit-rtl.c:1394 #4 0x1012a130 in operand_subword_force (op=0x30153558, offset=0, mode=DImode) at /farm/dje/src/src/gcc/emit-rtl.c:1407 #5 0x107abb8c in expand_binop (mode=DImode, binoptab=0x20055a60, op0=0x30153558, op1=0x3000c460, target=0x3015f498, unsignedp=1, methods=OPTAB_WIDEN) at /farm/dje/src/src/gcc/optabs.c:1738 #6 0x105b8318 in emit_store_flag (target=0x3015f498, code=NE, op0=0x30153528, op1=0x3000c450, mode=SImode, unsignedp=1, normalizep=1) at /farm/dje/src/src/gcc/expmed.c:5583 #7 0x105b7144 in emit_store_flag_1 (target=0x3015f498, code=NE, op0=0x301534e0, op1=0x3000c450, mode=DImode, unsignedp=1, normalizep=1) at /farm/dje/src/src/gcc/expmed.c:5310 #8 0x105b75e4 in emit_store_flag (target=0x3015f498, code=NE, op0=0x301534e0, op1=0x3000c450, mode=DImode, unsignedp=1, normalizep=1) at /farm/dje/src/src/gcc/expmed.c:5424 #9 0x105b8944 in emit_store_flag_force (target=0x3015f498, code=NE, op0=0x301534e0, op1=0x3000c450, mode=DImode, unsignedp=1, normalizep=1) at /farm/dje/src/src/gcc/expmed.c:5733 #10 0x103e4a08 in do_store_flag (exp=0x30165780, target=0x3015f498, mode=DImode) at /farm/dje/src/src/gcc/expr.c:9877 #11 0x103ddc58 in expand_expr_real_1 (exp=0x30165780, target=0x3015f498, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x2ff20348) at /farm/dje/src/src/gcc/expr.c:9109 #12 0x103cc03c in expand_expr_real (exp=0x30165780, target=0x3015f498, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x2ff20348) at /farm/dje/src/src/gcc/expr.c:7177 #13 0x103bb8f8 in store_expr (exp=0x30165780, target=0x3015f498, call_param_p=0, nontemporal=5) at /farm/dje/src/src/gcc/expr.c:4644 #14 0x103ba000 in expand_assignment (to=0x30158118, from=0x30165780, nontemporal=1240688) at /farm/dje/src/src/gcc/expr.c:4428 #15 0x103df0e0 in expand_expr_real_1 (exp=0x30165820, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /farm/dje/src/src/gcc/expr.c:9256 #16 0x103cc03c in expand_expr_real (exp=0x30165820, target=0x3000c450, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /farm/dje/src/src/gcc/expr.c:7177 #17 0x108f14e0 in expand_expr (exp=0x30165820, target=0x3000c450, mode=VOIDmode, modifier=EXPAND_NORMAL) at /farm/dje/src/src/gcc/expr.h:542 #18 0x108f30d4 in expand_expr_stmt (exp=0x30165820) at /farm/dje/src/src/gcc/stmt.c:1353 #19 0x108e9a50 in expand_gimple_basic_block (bb=0x3000e558) at /farm/dje/src/src/gcc/cfgexpand.c:2146 #20 0x108ec75c in gimple_expand_cfg () at /farm/dje/src/src/gcc/cfgexpand.c:2586 #21 0x10663db0 in execute_one_pass (pass=0x20094c18) at /farm/dje/src/src/gcc/passes.c:1289 #22 0x106641e8 in execute_pass_list (pass=0x20094c18) at /farm/dje/src/src/gcc/passes.c:1338 #23 0x10918560 in tree_rest_of_compilation (fndecl=0x3008e180) at /farm/dje/src/src/gcc/tree-optimize.c:394 #24 0x108b7b70 in cgraph_expand_function (node=0x30126200) at /farm/dje/src/src/gcc/cgraphunit.c:1097 #25 0x108b7e30 in cgraph_expand_all_functions () at /farm/dje/src/src/gcc/cgraphunit.c:1156 #26 0x108b86d8 in cgraph_optimize () at /farm/dje/src/src/gcc/cgraphunit.c:1379 #27 0x1003851c in c_write_global_declarations () at /farm/dje/src/src/gcc/c-decl.c:9410 #28 0x10002b80 in compile_file () at /farm/dje/src/src/gcc/toplev.c:1037 #29 0x10006060 in do_compile () at /farm/dje/src/src/gcc/toplev.c:2346 #30 0x10006198 in toplev_main (argc=5, argv=0x2ff22444) at /farm/dje/src/src/gcc/toplev.c:2391
Bootstrap of trunk revision 149105 fails on powerpc64-linux with the same ICE that David reported in comment #8, but building stage2: /libcpp/expr.c: In function ‘_cpp_parse_expr’: /home/janis/gcc_trunk_anonsvn/gcc/libcpp/expr.c:901:1: internal compiler error: in simplify_subreg, at simplify-rtx.c:4966 I'll get more information.
Subject: Re: Powerpc bootstrap is broken due to changes in expmed.c What happens with this patch? Index: expmed.c =================================================================== --- expmed.c (revision 149106) +++ expmed.c (working copy) @@ -5307,7 +5307,7 @@ OPTAB_DIRECT); if (op0both != 0) - return emit_store_flag (target, code, op0both, op1, word_mode, + return emit_store_flag (NULL_RTX, code, op0both, op1, word_mode, unsignedp, normalizep); } else if ((code == LT || code == GE) && op1 == const0_rtx) @@ -5318,7 +5318,7 @@ op0h = simplify_gen_subreg (word_mode, op0, mode, subreg_highpart_offset (word_mode, mode)); - return emit_store_flag (target, code, op0h, op1, word_mode, + return emit_store_flag (NULL_RTX, code, op0h, op1, word_mode, unsignedp, normalizep); } } (I'll see tonight if it cures also Michael's failures).
I tried bootstrapping with that patch and it did not solve the bootstrap failure in simplify_subreg.
The failure appears to need a compiler built in 32 bit mode.
Confirmed, a --with-cpu=default32 build dies with: /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/builtins.c: In function ‘get_memory_rtx’: /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/builtins.c:1210:10: internal compiler error: in simplify_subreg, at simplify-rtx.c:4966 Please submit a full bug report, while a --with-cpu=default64 built fine using the patch in Comment #11.
Guys, when something breaks can you attach preprocessed testcases?...
Created attachment 18103 [details] Preprocessed testcase Preprocessed source file compiled with: /home/bergner/gcc/PR40597/build/gcc-mainline-base-32/./prev-gcc/xgcc -B/home/bergner/gcc/PR40597/build/gcc-mainline-base-32/./prev-gcc/ -B/home/bergner/gcc/PR40597/install/gcc-mainline-base-32/powerpc64-linux/bin/ -B/home/bergner/gcc/PR40597/install/gcc-mainline-base-32/powerpc64-linux/bin/ -B/home/bergner/gcc/PR40597/install/gcc-mainline-base-32/powerpc64-linux/lib/ -isystem /home/bergner/gcc/PR40597/install/gcc-mainline-base-32/powerpc64-linux/include -isystem /home/bergner/gcc/PR40597/install/gcc-mainline-base-32/powerpc64-linux/sys-include -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat -fno-common -DHAVE_CONFIG_H -I. -I. -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/. -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/../include -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/../libcpp/include -I/home/bergner/tools/gmp-mpfr-ppc32/include -I/home/bergner/tools/gmp-mpfr-ppc32/include -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/../libdecnumber -I/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/../libdecnumber/dpd -I../libdecnumber /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/c-common.c -o c-common.o configure options: --target=powerpc64-linux --host=powerpc64-linux --build=powerpc64-linux --with-cpu=default32 --enable-threads=posix --enable-shared --enable-__cxa_atexit --enable-languages=c,c++,fortran,objc,obj-c++ --enable-secureplt --enable-checking=yes --with-long-double-128 --enable-decimal-float --disable-alsa
Regarding powerpc64, I see no difference at -O2 in assembly output between 2009-06-26 version and the version after the patch attached to this bug.
This is my backtrace: #0 fancy_abort (file=0x1091d148 "/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c", line=4966, function=0x1091dc04 "simplify_subreg") at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/diagnostic.c:730 #1 0x1043eab4 in simplify_subreg (outermode=SImode, op=0xf6ef5620, innermode=DImode, byte=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c:4965 #2 0x1043f69c in simplify_gen_subreg (outermode=<value optimized out>, op=<value optimized out>, innermode=<value optimized out>, byte=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c:5273 #3 0x1023759c in operand_subword (op=0xf6ef5620, offset=0, validate_address=1, mode=DImode) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/emit-rtl.c:1394 #4 0x102375fc in operand_subword_force (op=<value optimized out>, offset=<value optimized out>, mode=DImode) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/emit-rtl.c:1407 #5 0x10392efc in expand_binop (mode=DImode, binoptab=0x10b206a0, op0=0xf6ef5620, op1=0xf7e8e820, target=0xf6ef5640, unsignedp=1, methods=OPTAB_DIRECT) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/optabs.c:1817 #6 0x10247d08 in expand_shift (code=<value optimized out>, mode=DImode, shifted=0xf6ef5620, amount=0xf7c15810, target=0x0, unsignedp=1) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:2233 #7 0x10249d2c in expand_sdiv_pow2 (mode=DImode, op0=0xf7376b40, d=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:3778 #8 0x1024c25c in expand_divmod (rem_flag=0, code=<value optimized out>, mode=DImode, op0=0xf7376b40, op1=0xf7e8e4d0, target=0x0, unsignedp=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:4227 #9 0x1026c1b4 in expand_expr_real_1 (exp=0xf6fc4450, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:8836 #10 0x10263a00 in expand_expr_real_1 (exp=0xf6276400, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7328 #11 0x1026fcf4 in expand_expr_real (exp=0xf6276400, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7183 #12 0x101b2188 in expand_normal (exp=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.h:548 #13 0x101b5584 in precompute_register_parameters (num_actuals=2, args=<value optimized out>, reg_parm_seen=0xffaa960c) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/calls.c:677 #14 0x101b83e0 in expand_call (exp=0xf6fc43f0, target=0xf7376dc0, ignore=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/calls.c:2721 #15 0x10266f84 in expand_expr_real_1 (exp=0xf6fc43f0, target=0xf7376dc0, tmode=SImode, modifier=EXPAND_NORMAL, alt_rtl=0xffaa9830) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:8142 #16 0x1026fcd0 in expand_expr_real (exp=0xf6fc43f0, target=0xf7376dc0, tmode=SImode, modifier=EXPAND_NORMAL, alt_rtl=0xffaa9830) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7177 #17 0x10272290 in store_expr (exp=<value optimized out>, target=0xf7376dc0, call_param_p=0, nontemporal=0 '\0') at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:4644 #18 0x102609f0 in expand_assignment (to=0xf6276440, from=0xf6fc43f0, nontemporal=0 '\0') at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:4428 #19 0x1026e318 in expand_expr_real_1 (exp=0xf6fc4420, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:9256 #20 0x1026fcd0 in expand_expr_real (exp=0xf6fc4420, target=0xf7e8e450, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7177 #21 0x10444dd4 in expand_expr (exp=<value optimized out>, target=<value optimized out>, mode=<value optimized out>, modifier=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.h:542 #22 0x10444e14 in expand_expr_stmt (exp=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/stmt.c:1353 #23 0x107629ec in expand_gimple_basic_block (bb=0xf66e3280) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cfgexpand.c:2146 #24 0x10763238 in gimple_expand_cfg () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cfgexpand.c:2586 #25 0x103a21b0 in execute_one_pass (pass=0x10b5fcd0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/passes.c:1289 #26 0x103a2390 in execute_pass_list (pass=0x10b5fcd0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/passes.c:1338 #27 0x104be108 in tree_rest_of_compilation (fndecl=0xf659a600) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/tree-optimize.c:394 #28 0x10649d00 in cgraph_expand_function (node=0xf65b9500) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cgraphunit.c:1097 #29 0x1064babc in cgraph_expand_all_functions () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cgraphunit.c:1156 #30 0x1064c184 in cgraph_optimize () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cgraphunit.c:1379 #31 0x100958a4 in c_write_global_declarations () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/c-decl.c:9410 #32 0x1045bc8c in compile_file () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/toplev.c:1037 #33 0x1045d1f0 in do_compile () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/toplev.c:2346 #34 0x1045d2c8 in toplev_main (argc=14, argv=0xffaa9f04) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/toplev.c:2391 #35 0x1016e8a8 in main (argc=14, argv=0xffaa9f04) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/main.c:35
I have a patch that seems to fix the problem, but I am afraid it's just papering over it. Since the attached file does not fail without the patch from comment #11, would you please attach a testcase that fails without the patch, i.e. on current mainline?
Here's a backtrace for a 32-bit default build without Comment #11 patch: #0 fancy_abort (file=0x1096c5e4 "/home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c", line=4966, function=0x1096d0a0 "simplify_subreg") at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/diagnostic.c:730 #1 0x1045fd9c in simplify_subreg (outermode=SImode, op=0xf7b5a140, innermode=DImode, byte=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c:4965 #2 0x104615c4 in simplify_gen_subreg (outermode=<value optimized out>, op=<value optimized out>, innermode=<value optimized out>, byte=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c:5273 #3 0x1024966c in operand_subword (op=0xf7b5a140, offset=0, validate_address=1, mode=DImode) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/emit-rtl.c:1394 #4 0x102496cc in operand_subword_force (op=<value optimized out>, offset=<value optimized out>, mode=DImode) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/emit-rtl.c:1407 #5 0x103aeee0 in expand_binop (mode=DImode, binoptab=0x10b6c5f8, op0=0xf7b5a140, op1=0xf7e8e460, target=0xf7b5a0c0, unsignedp=1, methods=OPTAB_WIDEN) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/optabs.c:1738 #6 0x1025a8f8 in emit_store_flag (target=0xf7b5a0c0, code=NE, op0=0xf7b5a100, op1=0xf7e8e450, mode=SImode, unsignedp=<value optimized out>, normalizep=1) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:5583 #7 0x1025a070 in emit_store_flag_1 (target=0xf7b5a0c0, code=NE, op0=0xf7b5a0e0, op1=0xf7e8e450, mode=DImode, unsignedp=1, normalizep=1) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:5310 #8 0x1025a7a4 in emit_store_flag (target=0xf7b5a0c0, code=NE, op0=0xf7d192a0, op1=0xf7d192c0, mode=DImode, unsignedp=1, normalizep=1) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:5550 #9 0x1025ad50 in emit_store_flag_force (target=<value optimized out>, code=<value optimized out>, op0=<value optimized out>, op1=<value optimized out>, mode=<value optimized out>, unsignedp=<value optimized out>, normalizep=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:5733 #10 0x1027f098 in expand_expr_real_1 (exp=0xf786d540, target=0xf7b5a0c0, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:9877 #11 0x10272dbc in expand_expr_real_1 (exp=0xf7a4e940, target=0x0, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7328 #12 0x102822d4 in expand_expr_real (exp=0xf7a4e940, target=0x0, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7183 #13 0x10277a2c in expand_expr_real_1 (exp=0xf7b5a0a0, target=0xf7d0bf60, tmode=DImode, modifier=<value optimized out>, alt_rtl=0xffc167b0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.h:542 #14 0x102822d4 in expand_expr_real (exp=0xf7b5a0a0, target=0xf7d0bf60, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0xffc167b0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7183 #15 0x10289eb4 in store_expr (exp=<value optimized out>, target=0xf7d0bf60, call_param_p=0, nontemporal=0 '\0') at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:4644 #16 0x1026faa0 in expand_assignment (to=0xf7cbd140, from=0xf7b5a0a0, nontemporal=0 '\0') at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:4428 #17 0x10280058 in expand_expr_real_1 (exp=0xf786d510, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:9256 #18 0x102822d4 in expand_expr_real (exp=0xf786d510, target=0xf7e8e450, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7183 #19 0x1046b7f0 in expand_expr_stmt (exp=<value optimized out>) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.h:542 #20 0x107ac2dc in expand_gimple_basic_block (bb=0xf7b79e10) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cfgexpand.c:2146 #21 0x107ad900 in gimple_expand_cfg () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cfgexpand.c:2586 #22 0x103bfbc8 in execute_one_pass (pass=0x10babe08) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/passes.c:1289 #23 0x103bfdac in execute_pass_list (pass=0x10babe08) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/passes.c:1338 #24 0x104e6000 in tree_rest_of_compilation (fndecl=0xf7c9d380) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/tree-optimize.c:394 #25 0x10695b9c in cgraph_expand_function (node=0xf7d05600) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cgraphunit.c:1098 #26 0x10698940 in cgraph_optimize () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/cgraphunit.c:1157 #27 0x100958e4 in c_write_global_declarations () at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/c-decl.c:9410 #28 0x10480e7c in toplev_main (argc=24, argv=0xffc16e64) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/toplev.c:1037 #29 0x1016e8e8 in main (argc=24, argv=0xffc16e64) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/main.c:35 (gdb) frame 1 #1 0x1045fd9c in simplify_subreg (outermode=SImode, op=0xf7b5a140, innermode=DImode, byte=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/simplify-rtx.c:4965 4965 gcc_assert (GET_MODE (op) == innermode (gdb) pr op (reg:SI 1170) (gdb) frame 8 #8 0x1025a7a4 in emit_store_flag (target=0xf7b5a0c0, code=NE, op0=0xf7d192a0, op1=0xf7d192c0, mode=DImode, unsignedp=1, normalizep=1) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expmed.c:5550 5550 tem = emit_store_flag_1 (target, code, tem, const0_rtx, (gdb) pr op0 (reg:SI 1170) (gdb) pr op1 (reg:SI 1170) (gdb) pr target (reg:DI 1166) (gdb) frame 18 #18 0x102822d4 in expand_expr_real (exp=0xf786d510, target=0xf7e8e450, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/expr.c:7183 7183 ret = expand_expr_real_1 (exp, target, tmode, modifier, alt_rtl); (gdb) call debug_tree(exp) <modify_expr 0xf786d510 type <integer_type 0xf7c5d8c0 cpp_num_part sizes-gimplified asm_written public unsigned DI size <integer_cst 0xf7fd76f0 constant 64> unit size <integer_cst 0xf7fd7720 constant 8> align 64 symtab -138067152 alias set -1 canonical type 0xf7e99540 precision 64 min <integer_cst 0xf7fd7750 0> max <integer_cst 0xf7fd76c0 18446744073709551615> pointer_to_this <pointer_type 0xf7b644d0>> side-effects arg 0 <ssa_name 0xf7cbd140 type <integer_type 0xf7c5d8c0 cpp_num_part> visited var <var_decl 0xf7f65960 lhs$low>def_stmt lhs$low_143 = (cpp_num_part) D.9996_548; version 143> arg 1 <convert_expr 0xf7b5a0a0 type <integer_type 0xf7c5d8c0 cpp_num_part> arg 0 <ssa_name 0xf7a4e940 type <boolean_type 0xf7e995b0 _Bool> visited var <var_decl 0xf7d7f420 D.9996>def_stmt D.9996_548 = rhs$high_890 != lhs$high_897; version 548>>> (gdb) call debug_rtx(target) (const_int 0 [0x0])
Created attachment 18104 [details] Tetscase for use without comment #11 patch /home/bergner/gcc/PR40597/build/gcc-mainline-base-32/./prev-gcc/cc1 -fpreprocessed expr-ice.i -msecure-plt -quiet -dumpbase expr.c -auxbase-strip expr.o -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Werror -version -o expr.s
Created attachment 18106 [details] patch to test This is the patch to fix the bug.
Subject: Bug 40597 Author: bonzini Date: Wed Jul 1 12:05:56 2009 New Revision: 149137 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149137 Log: 2009-07-01 Paolo Bonzini <bonzini@gnu.org> PR bootstrap/40597 * expmed.c (emit_store_flag): Perform a conversion if necessary, after reducing a DImode cstore to SImode. Modified: trunk/gcc/ChangeLog trunk/gcc/expmed.c
Created attachment 18107 [details] Yet another ICE test case New test case for use after the commit of the patch in Comment #23.
Created attachment 18110 [details] ... and one more patch
Created attachment 18111 [details] And yet another one... Here's another test case to use with the patch from Comment #25.
Created attachment 18112 [details] ... watch out, this is on top of mainline, not on top of pr40957-3.patch (It would apply and just not work!)
Mainline + patch from Comment #27 has passed bootstrap with a 32-bit default build (the 64-bit default run is still running). I'm running the testsuite now and will compare to one of Janis' recent nightly testsuite results.
The 64-bit default build finished bootstrapping with no errors too.
Comparing the testsuite runs against the result from r149023 (the commit previous to the cond-optab checkin), the default 32-bit testsuite run showed no regressions. The 64-bit default testsuite run has a few extra regressions. The first I looked at [FAIL: gcc.dg/20020425-1.c (test for excess errors), both -m32 and -m64] was due to cc1 SEGV'ing. I'll build a debug compiler and use gdb to see where we're at. We also have this difference: Running target unix/-m32 -FAIL: abi_check +FAIL: 21_strings/basic_string/cons/char/1.cc execution test +FAIL: 21_strings/basic_string/cons/wchar_t/1.cc execution test +FAIL: 21_strings/basic_string/init-list.cc execution test +FAIL: 21_strings/basic_string/insert/char/1.cc execution test [snip lots more fails] Does the "abi_check" failure mean we didn't even run these tests with the "base" compiler?
I think we recursed off the stack. This is the backtrace: #0 0x000000001047bedc in gimple_boolify (expr=0x400005e33c0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:2750 #1 0x000000001047e230 in gimplify_cond_expr (expr_p=0x400005e3450, pre_p=0xfffff409e70, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:2932 #2 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e3450, pre_p=0xfffff409e70, post_p=0xfffff4093a8, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #3 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e3450, seq_p=0xfffff409e70) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #4 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e34a0, pre_p=0xfffff40b340, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #5 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e34a0, pre_p=0xfffff40b340, post_p=0xfffff40a878, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #6 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e34a0, seq_p=0xfffff40b340) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #7 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e34f0, pre_p=0xfffff40c810, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #8 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e34f0, pre_p=0xfffff40c810, post_p=0xfffff40bd48, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #9 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e34f0, seq_p=0xfffff40c810) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #10 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e3540, pre_p=0xfffff40dce0, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #11 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e3540, pre_p=0xfffff40dce0, post_p=0xfffff40d218, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #12 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e3540, seq_p=0xfffff40dce0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #13 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e3590, pre_p=0xfffff40f1b0, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #14 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e3590, pre_p=0xfffff40f1b0, post_p=0xfffff40e6e8, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #15 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e3590, seq_p=0xfffff40f1b0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #16 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e35e0, pre_p=0xfffff410680, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #17 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e35e0, pre_p=0xfffff410680, post_p=0xfffff40fbb8, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 #18 0x000000001048d38c in gimplify_stmt (stmt_p=0x400005e35e0, seq_p=0xfffff410680) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:5142 #19 0x0000000010480aec in gimplify_cond_expr (expr_p=0x400005e3630, pre_p=0xfffff411b50, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:3054 #20 0x00000000104996d8 in gimplify_expr (expr_p=0x400005e3630, pre_p=0xfffff411b50, post_p=0xfffff411088, gimple_test_f=@0x11106140: 0x1045bacc <is_gimple_stmt>, fallback=0) at /home/bergner/gcc/PR40597/gcc-mainline-base/gcc/gimplify.c:6456 [snip over 4000 gimplify_* frames]
Yes, but I don't think it's infinite recursion. There are 11,000 else ifs in the testcase.
Your patch from 2009-06-30 prevents the following code from being implemented jumpless on S/390: int a, b; ... int x = a == b; In emit_store_flag the following code now invokes emit_store_flag_1 instead of emit_store_flag: if ((code == EQ || code == NE) && op1 != const0_rtx) { tem = expand_binop (mode, xor_optab, op0, op1, subtarget, 1, OPTAB_WIDEN); if (tem == 0) tem = expand_binop (mode, sub_optab, op0, op1, subtarget, 1, OPTAB_WIDEN); if (tem != 0) tem = emit_store_flag_1 (target, code, tem, const0_rtx, mode, unsignedp, normalizep, target_mode); if (tem != 0) return tem; delete_insns_since (last); } But emit_store_flag_1 is not sufficient to implement this case jumpless since the code emitting the abs, sub and neg instructions is only in emit_store_flag: if (code == EQ || code == NE) { /* For EQ or NE, one way to do the comparison is to apply an operation that converts the operand into a positive number if it is nonzero or zero if it was originally zero. Then, for EQ, we subtract 1 and for NE we negate. This puts the result in the sign bit. Then we normalize with a shift, if needed. ...
Subject: Re: Powerpc bootstrap is broken due to changes in expmed.c On 07/23/2009 02:37 PM, krebbel at gcc dot gnu dot org wrote: > In emit_store_flag the following code now invokes emit_store_flag_1 instead of > emit_store_flag: This one in particular should be a recursive call indeed. Can you prepare a patch?
Subject: Re: Powerpc bootstrap is broken due to changes in expmed.c On Thu, Jul 23, 2009 at 10:52:01PM -0000, paolo dot bonzini at gmail dot com wrote: > > > ------- Comment #34 from paolo dot bonzini at gmail dot com 2009-07-23 22:52 ------- > Subject: Re: Powerpc bootstrap is broken due to changes > in expmed.c > > On 07/23/2009 02:37 PM, krebbel at gcc dot gnu dot org wrote: > > In emit_store_flag the following code now invokes emit_store_flag_1 instead of > > emit_store_flag: > > This one in particular should be a recursive call indeed. Can you > prepare a patch? > > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40597 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. Just to be sure we are on the same page, is the trunk up to date, or are there patches to the trunk that haven't been committed yet. It looks like the patch was committed.
No, all patches were committed.
The bootstrap failure is fixed, please reconfirm and reopen bugs for other failures or other targets.
Andreas, for s390-linux I get this jumpless code: f: xr %r2,%r3 lpr %r2,%r2 ahi %r2,-1 srl %r2,31 br %r14 for this testcase: int f(int a, int b) { return (a == b); } at -O1 or above.
Ok. That looks good. I think the S/390 problem from comment #33 got fixed with that patch: http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01392.html