Summary: | [4.1/4.2 regression] Ada ICE during bootstrap on many platforms | ||
---|---|---|---|
Product: | gcc | Reporter: | Pawel Sikora <pawel_sikora> |
Component: | ada | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | aj, anhvofrcaus, christian.joensson, debian-gcc, ebotcazou, gcc-bugs, kenner, mark, ro, schwab, ubizjak, uweigand |
Priority: | P5 | Keywords: | build, ice-on-valid-code |
Version: | 4.1.0 | ||
Target Milestone: | 4.1.0 | ||
Host: | Target: | MOVE_COST is low | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-11-15 06:31:15 | |
Bug Depends on: | 23171, 24415 | ||
Bug Blocks: | |||
Attachments: |
Andrew's FE patch.
Middle-end (IPA) patch. |
Description
Pawel Sikora
2005-07-17 21:03:31 UTC
also fails on i486/i686 target. on ppc ices in: stage1/xgcc -Bstage1/ -B/usr/ppc-pld-linux/bin/ -c -O2 -fsigned-char -gnatpg -gnata -g -O1 -fno-inline \ -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20050717 (experimental) (powerpc-pld-linux-gnu) GCC error: | | tree check: expected class | | Error detected at a-except.adb:1411:4 | raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:38 (In reply to comment #1) > on ppc ices in: The PPC bug is a different bug for sure which I have a patch and testing it right now. known to work: 4.1.0-20050711 known to fail: 4.1.0-20050717+ with current mainline i can't trig the ix86 bug. testing ppc... (In reply to comment #4) > with current mainline i can't trig the ix86 bug. > testing ppc... > ppc still fails with the same error. Confirmed, patch here then: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01327.html>. linked patch causes an ice. get correct patch from PR22631. Actually only the slight modification is needed to the linked patch. If I change the second agrument to create_tmp_var/create_tmp_var_raw to "C" instead of NULL, we no longer get an ICE. I don't understand why passing NULL to those functions change anything but oh well. I am no longer going to work on this. Still there as of 20050819 http://gcc.gnu.org/ml/gcc/2005-08/msg00538.html +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20050819 (experimental) (powerpc-apple-darwin8.3.0) GCC error: | tree check: expected class expression, have exceptional | (constructor) in get_base_var, at ipa-utils.c: 224 | Error detected at a-except.adb: 1411:4 Updated patch (negative review) here: http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01666.html As mentioned the patch is the wrong approach. And also the C++ front-end have the same issue, see PR 23171. *** Bug 23703 has been marked as a duplicate of this bug. *** Happens on s390 too. stage1/xgcc -Bstage1/ -B/home/uweigand/fsf/gcc-head-install/s390-ibm-linux/bin/ -c -g -O2 -gnatpg -gnata -I- -I. -Iada -I../../gcc-head/gcc/ada ../../gcc-head/gcc/ada/a-elchha.adb -o ada/a-elchha.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20050914 (experimental) (s390-ibm-linux-gnu) GCC error: | tree check: expected class | Error detected at a-elchha.adb:125:4 Same problem on mips-sgi-irix5.3 as of 20051004: stage1/xgcc -Bstage1/ -B/vol/gcc/share/mips-sgi-irix5.3/bin/ -c -g -O2 -gnatpg -gnata -I- -I. -Iada -I/vol/gnu/src/gcc/gcc-dist/gcc/ada /vol/gnu/src/gcc/gcc-dist/gcc/ada/a-elchha.adb -o ada/a-elchha.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20051004 (experimental) (mips-sgi-irix5.3) GCC error: | | tree check: expected class qs, have qs (expression) in exceptional, | | at constructor:269137156 | | Error detected at a-elchha.adb:125:4 | ../../xgcc -B../../ -c -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -fno-common -gnatpg -gnata -I- -I../rts -I. -I/usr/src/packages/BUILD/gcc-4.1.0-20051012/gcc/ada /usr/src/packages/BUILD/gcc-4.1.0-20051012/gcc/ada/make.adb -o make.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20051012 (experimental) (SUSE Linux) (powerpc64-suse-linux-gnu) GCC error:| | Segmentation fault | | Error detected at make.adb:7224:23 | still does not work (In reply to comment #15) > /usr/src/packages/BUILD/gcc-4.1.0-20051012/gcc/ada/make.adb -o make.o > +===========================GNAT BUG DETECTED==============================+ > | 4.1.0 20051012 (experimental) (SUSE Linux) (powerpc64-suse-linux-gnu) GCC > error:| > | Segmentation fault | > | Error detected at make.adb:7224:23 | This is probably a different bug. Ada not release critical. There is a middle-end part to this in gimplifier.c as I showed in my patch. *** Bug 24370 has been marked as a duplicate of this bug. *** *** Bug 24415 has been marked as a duplicate of this bug. *** (In reply to comment #16) > This is probably a different bug. It is not, as Richard was building with checking disabled as shown by 24415. Downgraded to P5. If this is not Ada-specific, please attach a C/C++ test case. Add mips and mips64, for reference, workaround patch from Andreas Schwab here: http://gcc.gnu.org/ml/gcc/2005-11/msg00239.html Index: ipa-utils.c =================================================================== --- ipa-utils.c (revision 106486) +++ ipa-utils.c (working copy) @@ -217,6 +217,7 @@ get_base_var (tree t) while (!SSA_VAR_P (t) && (!CONSTANT_CLASS_P (t)) + && TREE_CODE (t) != CONSTRUCTOR && TREE_CODE (t) != LABEL_DECL && TREE_CODE (t) != FUNCTION_DECL && TREE_CODE (t) != CONST_DECL) Well, the workaround removes the ICE, but constructor handling appears still broken: ada/sem_prag.o(.text+0xa58): In function `sem_prag.analyze_pragma.check_no_identifier': ../../gcc-head/gcc/ada/sem_prag.adb:1168: undefined reference to `C.1290.13979' ada/sem_prag.o(.text+0x8758): In function `sem_prag.analyze_pragma': ../../gcc-head/gcc/ada/sem_prag.adb:382: undefined reference to `C.3692.17381' collect2: ld returned 1 exit status make[2]: *** [gnat1] Error 1 (at least on s390 and s390x). *** Bug 24821 has been marked as a duplicate of this bug. *** Investigating. Mark, > Downgraded to P5. If this is not Ada-specific, please attach a C/C++ test > case. Well, this is definitely not Ada-specific, see comment #11. According to your analysis for PR c++/23171, the middle-end has started rejecting constructs it used to accept, lightly breaking the C++ compiler and severely breaking the Ada compiler in the process. What should we do for 4.1? Just one additional comment: the patch from comment #10 was rejected, maybe because it required changes to the core gimplifier. However, I've tested just the Ada front-end pieces from that patch, and this *already* fixed the problem for me. The reason appears to be that -in general- occurrences of ADDR_EXPR (CONSTRUCTOR) do not constitute a problem. The problem only comes when such constructs occur in turn as part of another (outer) CONSTRUCTOR. The middle-end never generates that case, only the Ada front-end does -- thus it suffices to fix those cases in the Ada front-end itself. So I guess it would be possible right now to fix the bootstrap issue by a pure front-end patch. (This doesn't address the more general question of whether or not the gimplifier has a bug that can be exposed by other front-ends too, of course ...) > So I guess it would be possible right now to fix the bootstrap issue > by a pure front-end patch. (This doesn't address the more general > question of whether or not the gimplifier has a bug that can be exposed > by other front-ends too, of course ...) OK, thanks for the analysis. Richard, what do you think? The pure front-end patch Ulrich is talking about is the Ada FE part of http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01666.html With that patch applied, Ada bootstraps on s390-ibm-linux and s390x-ibm-linux. Regression test results are at: http://gcc.gnu.org/ml/gcc-testresults/2005-11/msg00831.html http://gcc.gnu.org/ml/gcc-testresults/2005-11/msg00832.html There's still quite a number of regressions, but the good news is that all of them are already known from other platforms. Sorted by PR number, the regressions are: both s390 and s390x: PR 18659: c32001e c64105b c95086b PR 22333: c34007p c34007r c45282b PR 20548: c52103x c52104x c52104y PR 22561: ca11c01 s390x only: PR 18819: cdd2a01(*) cdd2a02 s390 only: PR 20753: ce3810b (*) The PR mentions only cdd2a02. But cdd2a01 fails with seemingly the same symptom for me ... w/o patch still ICEs: # ppc: stage1/xgcc -Bstage1/ -B/usr/ppc-pld-linux/bin/ -c -O2 -ggdb -gnatpg -gnata -g -O1 -fno-inline \ -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20051121 (prerelease) (powerpc-pld-linux-gnu) Segmentation fault | | Error detected at a-except.adb:1305:1 | raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:380 make[2]: *** [ada/a-except.o] Error 1 # athlon + amd64: stage1/xgcc -Bstage1/ -B/usr/x86_64-pld-linux/bin/ -c -march=x86-64 -O2 -ggdb -gnatpg -gnata -g -O1 -fno-inline \ -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o raised STORAGE_ERROR : stack overflow (or erroneous memory access) make[2]: *** [ada/a-except.o] Error 1 with patch from http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01666.html after manual merge (due to 1 reject): # ppc: ../../xgcc -B../../ -c -O2 -ggdb -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- -I../rts -I. -I/home/users/builder2/rpm/BUILD/gcc/gcc/ada /home/users/builder2/rpm/BUILD/gcc/gcc/ada/make.adb -o make.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20051121 (prerelease) (powerpc-pld-linux-gnu) Segmentation fault | | Error detected at make.adb:7541:23 | raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:380 finally, ada is actually dead. > with patch from http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01666.html Probably not the correct long-term fix. Might be good enough for 4.1 though. > finally, ada is actually dead. Not very constructive, I'm afraid. Care to devise a fix? (In reply to comment #32) > > with patch from http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01666.html > > Probably not the correct long-term fix. Might be good enough for 4.1 though. this fix doesn't help for current 4.1. workaround from #c23 doesn;t help either. > > finally, ada is actually dead. > > Not very constructive, I'm afraid. Care to devise a fix? sorry, i don't known too much about compiler's infrastructure. i'm just a software developer and packager. i can test builds/fixes and provide backtraces on PPC970FX but nothing more... $ gdb stage1/gnat1 (gdb) set args -I- -I. -Iada -I../../gcc/ada -quiet -dumpbase a-except.adb -O2 -O1 -fsigned-char -fno-inline -ggdb -gnatpg -gnata -g -gnatO ada/a-except.o ../../gcc/ada/a-except.adb -o /tmp/ccaqK3JS.s (gdb) r Starting program: /home/users/builder2/rpm/BUILD/gcc/obj-ppc-pld-linux/gcc/stage1/gnat1 -I- -I. -Iada -I../../gcc/ada -quiet -dumpbase a-except.adb -O2 -O1 -fno-inline -ggdb -gnatpg -gnata -g -gnatO ada/a-except.o ../../gcc/ada/a-except.adb -o /tmp/ccaqK3JS.s Breakpoint 3 at 0xfee33e8 Breakpoint 4 at 0xfee1d90 Program received signal SIGSEGV, Segmentation fault. 0x109c6418 in get_base_var (t=0x0) at ../../gcc/ipa-utils.c:218 218 while (!SSA_VAR_P (t) (gdb) bt #0 0x109c6418 in get_base_var (t=0x0) at ../../gcc/ipa-utils.c:218 #1 0x10840d1c in look_for_address_of (t=0x303cc720) at ../../gcc/ipa-reference.c:345 #2 0x10840da4 in check_rhs_var (local=0x0, t=0x303cc720) at ../../gcc/ipa-reference.c:360 #3 0x108413e4 in scan_for_static_refs (tp=0x303cb344, walk_subtrees=0x7ffff084, data=0x0) at ../../gcc/ipa-reference.c:553 #4 0x1079e554 in walk_tree (tp=0x303cb344, func=0x1084117c <scan_for_static_refs>, data=0x0, pset=0x11086c80) at ../../gcc/tree.c:7115 #5 0x1079ecd4 in walk_tree (tp=0x303ea6cc, func=0x1084117c <scan_for_static_refs>, data=0x0, pset=0x11086c80) at ../../gcc/tree.c:7286 #6 0x10841b78 in analyze_variable (vnode=0x304653f0) at ../../gcc/ipa-reference.c:774 #7 0x108423a4 in static_execute () at ../../gcc/ipa-reference.c:901 #8 0x107c8ea0 in execute_one_pass (pass=0x10bc1470) at ../../gcc/passes.c:828 #9 0x107c9038 in execute_ipa_pass_list (pass=0x10bc1470) at ../../gcc/passes.c:874 #10 0x1083bb80 in ipa_passes () at ../../gcc/cgraphunit.c:1223 #11 0x1083bc6c in cgraph_optimize () at ../../gcc/cgraphunit.c:1257 #12 0x1001c77c in gnat_parse_file (set_yydebug=0) at ../../gcc/ada/misc.c:245 #13 0x10786bbc in compile_file () at ../../gcc/toplev.c:990 #14 0x10788ecc in do_compile () at ../../gcc/toplev.c:1948 #15 0x10788f60 in toplev_main (argc=21, argv=0x7ffff5f4) at ../../gcc/toplev.c:1980 #16 0x103f0300 in main (argc=21, argv=0x7ffff5f4) at ../../gcc/main.c:35 > this fix doesn't help for current 4.1.
It works (or worked) on s390 at least and fix the first problem on PPC though.
Did you try to compile make.adb at -O1 or -O0?
(In reply to comment #34) > Did you try to compile make.adb at -O1 or -O0? i always do a full bootstrap with different flags for stage1 and 2+. make bootstrap \ BOOT_CFLAGS="%{rpmcflags}" \ STAGE1_CFLAGS="%{rpmcflags} -O0" \ stage1 (with -O0) builds, stage2 fails. (rpmcflags == -O2 + additional options). > i always do a full bootstrap with different flags for stage1 and 2+.
That doesn't cover the Ada tools. They build for me at -O0 on PowerPC so with Andrew's FE patch + a possible tweak in the Makefile, you should have an Ada compiler.
Created attachment 10331 [details]
Andrew's FE patch.
> That doesn't cover the Ada tools. They build for me at -O0 on PowerPC so with
> Andrew's FE patch + a possible tweak in the Makefile, you should have an Ada
> compiler.
They even build for me at -O2 on PowerPC with Andrew's patch.
(In reply to comment #38) > > That doesn't cover the Ada tools. They build for me at -O0 on PowerPC so with > > Andrew's FE patch + a possible tweak in the Makefile, you should have an Ada > > compiler. > > They even build for me at -O2 on PowerPC with Andrew's patch. > with minor makefile tweak ada builds with -O2 on ppc. --- gcc/gcc/ada/Makefile.in.orig 2005-11-23 16:48:27.000000000 +0000 +++ gcc/gcc/ada/Makefile.in 2005-11-24 10:14:25.987115520 +0000 @@ -1899,6 +1899,12 @@ $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O2 $(ADA_INCLUDES) \ $< $(OUTPUT_OPTION) +# [Bug ada/22533] [4.1/4.2 regression] Ada ICE during bootstrap + +make.o : make.adb make.ads + $(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) -O1 $(ADA_INCLUDES) \ + $< $(OUTPUT_OPTION) + adadecode.o : adadecode.c adadecode.h aux-io.o : aux-io.c argv.o : argv.c it also builds on i486. unfortunately amd64 fails on a-except even with -O0. (...) stage1/xgcc -Bstage1/ -B/usr/x86_64-pld-linux/bin/ -c -march=x86-64 -O2 -ggdb -gnatpg -gnata -g -O0 \ -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o +===========================GNAT BUG DETECTED==============================+ | 4.1.0 20051123 (prerelease) (x86_64-pld-linux-gnu) Storage_Error stack overflow (or erroneous memory access)| | Error detected at a-except.adb:42:17 | builds on alpha-linux, powerpc-linux, mips-linux, s390-linux (Debian unstable) with the patch from the attachment and the patch from #39. No test results yet. Matthias (In reply to comment #40) > it also builds on i486. unfortunately amd64 fails on a-except even with -O0. > > (...) > stage1/xgcc -Bstage1/ -B/usr/x86_64-pld-linux/bin/ -c -march=x86-64 -O2 -ggdb > -gnatpg -gnata -g -O0 \ > -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o > +===========================GNAT BUG DETECTED==============================+ > | 4.1.0 20051123 (prerelease) (x86_64-pld-linux-gnu) > Storage_Error stack overflow (or erroneous memory access)| > | Error detected at a-except.adb:42:17 | > it builds on ix86 with -march=i486, (i586 not tested) and i686 but fails in the same way on ix86/-march=athlon and amd64/-march=x86-64. maybe this failure is related to some lowlevel amd-specific parts? i've done quick tests on ix86: $ stage1/xgcc -Bstage1/ -c -gnatpg -gnata -g -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o -fno-inline -O1 -march=i{486,586,686,pentium,pentiumpro} WORKS. but -march={athlon,pentium2,pentium3,pentium4} FAILS. the i386 variant with -mmx option FAILS either. $ stage1/xgcc -Bstage1/ -c -gnatpg -gnata -g -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/a-except.adb -o ada/a-except.o -fno-inline -O1 -march=athlon raised STORAGE_ERROR : stack overflow (or erroneous memory access) Program received signal SIGSEGV, Segmentation fault. 0x0839c8c5 in insert_insn_on_edge () (gdb) bt #0 0x0839c8c5 in insert_insn_on_edge () #1 0x085c5e6b in fixup_abnormal_edges () #2 0x0859b30f in convert_regs () #3 0x0859b684 in reg_to_stack () #4 0x0859b6bb in rest_of_handle_stack_regs () #5 0x0860dc88 in execute_one_pass () #6 0x0860dd47 in execute_pass_list () #7 0x0860dd67 in execute_pass_list () #8 0x0860dd67 in execute_pass_list () #9 0x08328868 in tree_rest_of_compilation () #10 0x0805e8d5 in gnat_expand_body () #11 0x08656a58 in cgraph_expand_function () #12 0x08656bed in cgraph_expand_all_functions () #13 0x08657109 in cgraph_optimize () #14 0x0805dd9e in gnat_parse_file () #15 0x085e68a4 in compile_file () #16 0x085e7f0d in do_compile () #17 0x085e7f75 in toplev_main () #18 0x0832472c in main () on amd64: Program received signal SIGSEGV, Segmentation fault. 0x00000000007143a8 in insert_insn_on_edge (pattern=0x2a96415410, e=0x0) at ../../gcc/cfgrtl.c:1412 1412 gcc_assert (!((e->flags & EDGE_ABNORMAL) && EDGE_CRITICAL_P (e))); (gdb) bt #0 0x00000000007143a8 in insert_insn_on_edge (pattern=0x2a96415410, e=0x0) at ../../gcc/cfgrtl.c:1412 During symbol reading, Incomplete CFI data; unspecified registers at 0x0000000000714398. (...) #1 0x00000000009acfed in fixup_abnormal_edges () at ../../gcc/reload1.c:8252 During symbol reading, Incomplete CFI data; unspecified registers at 0x00000000009acdb3. (...) #2 0x000000000097ef8d in convert_regs (file=0x0) at ../../gcc/reg-stack.c:3097 #3 0x000000000097f328 in reg_to_stack (file=0x0) at ../../gcc/reg-stack.c:3207 #4 0x000000000097f35f in rest_of_handle_stack_regs () at ../../gcc/reg-stack.c:3230 #5 0x0000000000a001ae in execute_one_pass (pass=0xee2360) at ../../gcc/passes.c:828 #6 0x0000000000a0026d in execute_pass_list (pass=0xee2360) at ../../gcc/passes.c:860 #7 0x0000000000a0028b in execute_pass_list (pass=0xee2b20) at ../../gcc/passes.c:861 #8 0x0000000000a0028b in execute_pass_list (pass=0xee2ac0) at ../../gcc/passes.c:861 #9 0x0000000000691057 in tree_rest_of_compilation (fndecl=0x2a95e1e500) at ../../gcc/tree-optimize.c:419 #10 0x00000000004192de in gnat_expand_body (gnu_decl=0x2a95e1e500) at ../../gcc/ada/misc.c:649 #11 0x0000000000a5774f in cgraph_expand_function (node=0x2a95ea1630) at ../../gcc/cgraphunit.c:1055 #12 0x0000000000a57917 in cgraph_expand_all_functions () at ../../gcc/cgraphunit.c:1121 #13 0x0000000000a57ea3 in cgraph_optimize () at ../../gcc/cgraphunit.c:1278 #14 0x0000000000418612 in gnat_parse_file (set_yydebug=0) at ../../gcc/ada/misc.c:245 #15 0x00000000009d2f2b in compile_file () at ../../gcc/toplev.c:990 #16 0x00000000009d4876 in do_compile () at ../../gcc/toplev.c:1948 #17 0x00000000009d48da in toplev_main (argc=19, argv=0x7fbffff508) at ../../gcc/toplev.c:1980 #18 0x000000000068cbff in main (argc=19, argv=0x7fbffff508) at ../../gcc/main.c:35 i'll check this witout Uros' switch-mmx-mode patchset. (In reply to comment #43) > i'll check this witout Uros' switch-mmx-mode patchset. confirmed. Uros' patchset from PR19161 causes this ICE with -mmmx. Uros, can you look at this? Created attachment 10552 [details]
Middle-end (IPA) patch.
Tested Darwin/4.1 branch.
Mark's change for PR 23171 has eliminated the ICE on PowerPC/Darwin. |