Bug 25127 - [4.0/4.1 Regression] internal compiler error: in rs6000_emit_prologue, at config/rs6000/rs6000.c:14039
Summary: [4.0/4.1 Regression] internal compiler error: in rs6000_emit_prologue, at con...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P1 blocker
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
: 29310 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-11-27 21:54 UTC by Erik Schnetter
Modified: 2008-02-20 22:44 UTC (History)
8 users (show)

See Also:
Host:
Target: powerpc-*-darwin*
Build:
Known to work: 4.2.0 4.3.0
Known to fail: 4.1.1 4.1.2 4.1.3
Last reconfirmed: 2007-01-25 19:18:42


Attachments
Failing preprocessed source code (gzipped) (30.17 KB, application/octet-stream)
2005-11-28 06:13 UTC, Erik Schnetter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Schnetter 2005-11-27 21:54:20 UTC
I try to install gcc 4.1; I have

$ svn info
Path: .
URL: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 107570
Node Kind: directory
Schedule: normal
Last Changed Author: kargl
Last Changed Rev: 107569
Last Changed Date: 2005-11-27 09:51:54 -0600 (Sun, 27 Nov 2005)
Properties Last Updated: 2005-11-27 14:41:39 -0600 (Sun, 27 Nov 2005)

I configured with

$ CFLAGS='-g -O2 -mcpu=G4 -mabi=altivec -mlongcall' CXXFLAGS='-g -O2 -mcpu=G4 -mabi=altivec -mlongcall' FCFLAGS='-g -O2 -mcpu=G4 -mabi=altivec -mlongcall' /Users/eschnett/src/gcc-4.1/configure --prefix=/Users/eschnett/gcc --with-mpfr=/Users/eschnett --disable-multilib --enable-languages=c,c++,fortran,java,objc,treelang

and a "make boostrap" results in

./xgcc -B./ -B/Users/eschnett/gcc/powerpc-apple-darwin8.3.0/bin/ -isystem /Users/eschnett/gcc/powerpc-apple-darwin8.3.0/include -isystem /Users/eschnett/gcc/powerpc-apple-darwin8.3.0/sys-include -L/Users/eschnett/src/gcc-build-4.1/gcc/../ld -O2  -O2 -g -O2 -mcpu=G4 -mabi=altivec -mlongcall  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -Wa,-force_cpusubtype_ALL -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I/Users/eschnett/src/gcc-4.1/gcc -I/Users/eschnett/src/gcc-4.1/gcc/. -I/Users/eschnett/src/gcc-4.1/gcc/../include -I./../intl -I/Users/eschnett/src/gcc-4.1/gcc/../libcpp/include -I/Users/eschnett/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c /Users/eschnett/src/gcc-4.1/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o
/Users/eschnett/src/gcc-4.1/gcc/unwind.inc: In function ‘_Unwind_RaiseException’:
/Users/eschnett/src/gcc-4.1/gcc/unwind.inc:140: internal compiler error: in rs6000_emit_prologue, at config/rs6000/rs6000.c:14039
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
{standard input}:4874:non-relocatable subtraction expression, "L_abort$stub" minus "L550_pic"
{standard input}:4874:symbol: "L_abort$stub" can't be undefined in a subtraction expression
{standard input}:4872:non-relocatable subtraction expression, "L_abort$stub" minus "L550_pic"
{standard input}:4872:symbol: "L_abort$stub" can't be undefined in a subtraction expression
{standard input}:4602:non-relocatable subtraction expression, "L_abort$stub" minus "L517_pic"
{standard input}:4602:symbol: "L_abort$stub" can't be undefined in a subtraction expression
{standard input}:4600:non-relocatable subtraction expression, "L_abort$stub" minus "L517_pic"

[some similar lines omitted]

{standard input}:unknown:Undefined local symbol L_abort$stub
{standard input}:unknown:Undefined local symbol L__Unwind_Find_FDE$stub
{standard input}:unknown:Undefined local symbol L_memcpy$stub
{standard input}:unknown:Undefined local symbol L_memset$stub
{standard input}:unknown:Undefined local symbol L__Unwind_fallback_frame_state_for$stub
{standard input}:unknown:Undefined local symbol L_strlen$stub
{standard input}:unknown:Undefined local symbol L_pthread_once$stub
make[3]: *** [libgcc/./unwind-dw2.o] Error 1
make[2]: *** [libgcc.a] Error 2
make[1]: *** [stage1_build] Error 2
make: *** [bootstrap] Error 2
Comment 1 Andrew Pinski 2005-11-27 22:19:41 UTC
Is there a reason why you are bootstrapping with -mlongcall?
Comment 2 Erik Schnetter 2005-11-27 22:30:36 UTC
In the end, I want to build some large applications, and I had an error at one time where one of gcc's run time libraries needed to be built with -mlongcall.  I didn't investigate this more closely, and I could be wrong with that statement, so that some other change that I made made my application build successfully.

I've been bootstrapping with -mlongcall for some time, and I didn't encounter any problems.  I'm using Apple's gcc 3.3 for bootstrapping.  I'm now re-running the bootstrap with the options "-mcpu=G4 -mabi=altivec" removed, and this seems to go fine (so far).
Comment 3 Erik Schnetter 2005-11-28 03:19:24 UTC
After removing the flags "-mcpu=G4 -mabi=altivec" from the explicit compiler options, the bootstrap completes fine.
Comment 4 Andrew Pinski 2005-11-28 05:07:32 UTC
Can you attach the preprocessed source for unwind-dw2.c when bootstrapping with options that ICE?
Comment 5 Erik Schnetter 2005-11-28 06:13:30 UTC
Created attachment 10351 [details]
Failing preprocessed source code (gzipped)
Comment 6 Daniel Davies 2005-12-13 22:12:41 UTC
(In reply to comment #0)
> I try to install gcc 4.1; I have
> 
> $ svn info
> Path: .
> URL: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch
> Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
> Revision: 107570
> Node Kind: directory
> Schedule: normal
> Last Changed Author: kargl
> Last Changed Rev: 107569
> Last Changed Date: 2005-11-27 09:51:54 -0600 (Sun, 27 Nov 2005)
> Properties Last Updated: 2005-11-27 14:41:39 -0600 (Sun, 27 Nov 2005)
> 
> I configured with
> 
> $ CFLAGS='-g -O2 -mcpu=G4 -mabi=altivec -mlongcall' CXXFLAGS='-g -O2 -mcpu=G4
> -mabi=altivec -mlongcall' FCFLAGS='-g -O2 -mcpu=G4 -mabi=altivec -mlongcall'
> /Users/eschnett/src/gcc-4.1/configure --prefix=/Users/eschnett/gcc
> --with-mpfr=/Users/eschnett --disable-multilib
> --enable-languages=c,c++,fortran,java,objc,treelang
> 
> and a "make boostrap" results in
> 
> ./xgcc -B./ -B/Users/eschnett/gcc/powerpc-apple-darwin8.3.0/bin/ -isystem
> /Users/eschnett/gcc/powerpc-apple-darwin8.3.0/include -isystem
> /Users/eschnett/gcc/powerpc-apple-darwin8.3.0/sys-include
> -L/Users/eschnett/src/gcc-build-4.1/gcc/../ld -O2  -O2 -g -O2 -mcpu=G4
> -mabi=altivec -mlongcall  -DIN_GCC    -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem
> ./include  -Wa,-force_cpusubtype_ALL -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
> -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I/Users/eschnett/src/gcc-4.1/gcc
> -I/Users/eschnett/src/gcc-4.1/gcc/.
> -I/Users/eschnett/src/gcc-4.1/gcc/../include -I./../intl
> -I/Users/eschnett/src/gcc-4.1/gcc/../libcpp/include -I/Users/eschnett/include
> -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c
> /Users/eschnett/src/gcc-4.1/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o
> /Users/eschnett/src/gcc-4.1/gcc/unwind.inc: In function
> ‘_Unwind_RaiseException’:
> /Users/eschnett/src/gcc-4.1/gcc/unwind.inc:140: internal compiler error: in
> rs6000_emit_prologue, at config/rs6000/rs6000.c:14039
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> {standard input}:4874:non-relocatable subtraction expression, "L_abort$stub"
> minus "L550_pic"
> {standard input}:4874:symbol: "L_abort$stub" can't be undefined in a
> subtraction expression
> {standard input}:4872:non-relocatable subtraction expression, "L_abort$stub"
> minus "L550_pic"
> {standard input}:4872:symbol: "L_abort$stub" can't be undefined in a
> subtraction expression
> {standard input}:4602:non-relocatable subtraction expression, "L_abort$stub"
> minus "L517_pic"
> {standard input}:4602:symbol: "L_abort$stub" can't be undefined in a
> subtraction expression
> {standard input}:4600:non-relocatable subtraction expression, "L_abort$stub"
> minus "L517_pic"
> 
> [some similar lines omitted]
> 
> {standard input}:unknown:Undefined local symbol L_abort$stub
> {standard input}:unknown:Undefined local symbol L__Unwind_Find_FDE$stub
> {standard input}:unknown:Undefined local symbol L_memcpy$stub
> {standard input}:unknown:Undefined local symbol L_memset$stub
> {standard input}:unknown:Undefined local symbol
> L__Unwind_fallback_frame_state_for$stub
> {standard input}:unknown:Undefined local symbol L_strlen$stub
> {standard input}:unknown:Undefined local symbol L_pthread_once$stub
> make[3]: *** [libgcc/./unwind-dw2.o] Error 1
> make[2]: *** [libgcc.a] Error 2
> make[1]: *** [stage1_build] Error 2
> make: *** [bootstrap] Error 2
> 
I had exactly the same bug when attempting to build gcc-4.0.1 and gcc-4.0.2 on Mac OSX 10.4.3 (Mac Mini, 512 MB memory).  I used
cd build
../gcc-4.0.2/configure --with-cpu=7450 --with-float=hard --disable-nls
...
make bootstrap.

Changing to
../gcc-4.0.2/configure --disable-nls
appears to have solved the problem.
Comment 7 Andrew Pinski 2006-02-02 19:56:52 UTC
Reducing.
Comment 8 Andrew Pinski 2006-02-02 20:22:25 UTC
Reduced testcase:
struct _Unwind_Context
{
  void *ra;
}
init_dwarf_reg_size_table (void)
{
  struct _Unwind_Context this_context, cur_context;
  __builtin_unwind_init ();
  long offset = uw_install_context_1 ((&this_context), (&cur_context));
  void *handler = __builtin_frob_return_addr ((&cur_context)->ra);
  __builtin_eh_return (offset, handler);
}
Comment 9 Andrew Pinski 2006-10-01 20:19:37 UTC
*** Bug 29310 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2006-10-01 20:25:53 UTC
Caused by:
2004-08-18  Fariborz Jahanian <fjahanian@apple.com>

        * config/rs6000/altivec.md: Add new patterns for calls to
        save_world/rest_world functions.

        * config/rs6000/rs6000-protos.h: (save_world_operation,
        restore_world_operation) new declarations.

        * config/rs6000/rs6000.c: (struct rs6000_stack) new world_save_p
        field added.
        (rs6000_stack_info): Set world_save_p field.
        (save_world_operation): New function.
        (restore_world_operation): New function.
        (compute_save_world_info): New function.
        (rs6000_stack_info): Call compute_save_world_info.
        (rs6000_emit_prologue): Check for world_save_p and generate
        pattern to call save_world for saving all non-volatile and
        special registers.
        (rs6000_emit_epilogue): Check for world_save_p and generate
        pattern to call rest_world to restore saved registers.

        config/rs6000/rs6000.h: macros FIRST_SAVED_ALTIVEC_REGNO,
        FIRST_SAVED_FP_REGNO, FIRST_SAVED_GP_REGNO defined.
        (rs6000_reg_names): New entries added for save_world_operation and
        restore_world_operation.

Which makes this a regression.
Comment 11 Gabriel Dos Reis 2007-01-25 15:58:11 UTC
This PR will not be fixed in GCC-4.0.4, so adjusting
the milestone.
Comment 12 Geoff Keating 2007-01-25 19:18:42 UTC
I'm working on this.
Comment 13 Geoff Keating 2007-01-25 19:20:33 UTC
... at least, I think I have a patch which will fix it.
Comment 14 Geoff Keating 2007-01-25 20:32:20 UTC
Subject: Bug 25127

Author: geoffk
Date: Thu Jan 25 20:32:06 2007
New Revision: 121184

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121184
Log:
2007-01-24  Geoffrey Keating  <geoffk@apple.com>

	PR 25127
	* config/rs6000/rs6000.c (first_altivec_reg_to_save): On Darwin,
	save Altivec registers in an eh_return function.
	(compute_vrsave_mask): Likewise.
	(rs6000_stack_info): Correct AIX/Darwin stack alignment computation
	for saving Altivec registers.
	(rs6000_emit_prologue): Don't allocate stack twice in
	eh_return function.  Correct expected value of altivec_save_offset
	when using save_world.  Describe save of R0 to stack when using
	save_world.  Describe stack pointer adjustment when using
	save_world.  Remove duplicated eh_return parameter register saving.
	Update sp_offset variable after save_world.
	* config/rs6000/t-darwin (LIB2FUNCS_STATIC_EXTRA): Remove
	darwin-world.asm.
	(LIB2FUNCS_EXTRA): Add darwin-world.asm.
	* config/rs6000/darwin.h (SUBTARGET_OVERRIDE_OPTIONS): -m64
	implies Altivec.

Index: gcc/testsuite/ChangeLog
2007-01-24  Geoffrey Keating  <geoffk@apple.com>

	* gcc.target/powerpc/darwin-ehreturn-1.c: New.
	* g++.dg/eh/simd-2.C: Also run on Darwin.
	* g++.dg/eh/simd-3.C: New.
	* g++.dg/eh/simd-4.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/eh/simd-3.C
    trunk/gcc/testsuite/g++.dg/eh/simd-4.C
    trunk/gcc/testsuite/gcc.target/powerpc/darwin-ehreturn-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/darwin.h
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/rs6000/t-darwin
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/eh/simd-2.C

Comment 15 Geoff Keating 2007-01-26 00:04:27 UTC
Subject: Bug 25127

Author: geoffk
Date: Fri Jan 26 00:03:28 2007
New Revision: 121190

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121190
Log:
2007-01-24  Geoffrey Keating  <geoffk@apple.com>

	PR 25127
	* config/rs6000/rs6000.c (first_altivec_reg_to_save): On Darwin,
	save Altivec registers in an eh_return function.
	(compute_vrsave_mask): Likewise.
	(rs6000_stack_info): Correct AIX/Darwin stack alignment computation
	for saving Altivec registers.
	(rs6000_emit_prologue): Don't allocate stack twice in
	eh_return function.  Correct expected value of altivec_save_offset
	when using save_world.  Describe save of R0 to stack when using
	save_world.  Describe stack pointer adjustment when using
	save_world.  Remove duplicated eh_return parameter register saving.
	Update sp_offset variable after save_world.
	* config/rs6000/t-darwin (LIB2FUNCS_STATIC_EXTRA): Remove
	darwin-world.asm.
	(LIB2FUNCS_EXTRA): Add darwin-world.asm.
	* config/rs6000/darwin.h (SUBTARGET_OVERRIDE_OPTIONS): -m64
	implies Altivec.

Index: gcc/testsuite/ChangeLog
2007-01-24  Geoffrey Keating  <geoffk@apple.com>

	* gcc.target/powerpc/darwin-ehreturn-1.c: New.
	* g++.dg/eh/simd-2.C: Also run on Darwin.
	* g++.dg/eh/simd-3.C: New.
	* g++.dg/eh/simd-4.C: New.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/eh/simd-3.C
      - copied unchanged from r121184, trunk/gcc/testsuite/g++.dg/eh/simd-3.C
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/eh/simd-4.C
      - copied unchanged from r121184, trunk/gcc/testsuite/g++.dg/eh/simd-4.C
    branches/gcc-4_2-branch/gcc/testsuite/gcc.target/powerpc/darwin-ehreturn-1.c
      - copied unchanged from r121184, trunk/gcc/testsuite/gcc.target/powerpc/darwin-ehreturn-1.c
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/rs6000/darwin.h
    branches/gcc-4_2-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-4_2-branch/gcc/config/rs6000/t-darwin
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/eh/simd-2.C

Comment 16 Geoff Keating 2007-01-26 00:05:36 UTC
This should be fixed now in the trunk and 4.2 branches.
Comment 17 Richard Biener 2008-02-20 22:44:07 UTC
Fixed since 4.2.0, wontfix on earlier branches.