Bug 63703 - [4.9.2/5 Regression] Bootstrap broken on powerpc-apple-darwin, cc1: internal compiler error: in init_reg_sets
Summary: [4.9.2/5 Regression] Bootstrap broken on powerpc-apple-darwin, cc1: internal ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.9.2
: P1 normal
Target Milestone: 4.9.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 63773
  Show dependency treegraph
 
Reported: 2014-10-31 18:34 UTC by Douglas Mencken
Modified: 2014-11-27 05:47 UTC (History)
4 users (show)

See Also:
Host: powerpc-apple-darwin9
Target: powerpc-apple-darwin9
Build: powerpc-apple-darwin9
Known to work: 4.9.1
Known to fail: 4.9.2
Last reconfirmed: 2014-11-23 00:00:00


Attachments
Proposed patch (319 bytes, patch)
2014-11-24 16:31 UTC, Rohit
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Douglas Mencken 2014-10-31 18:34:46 UTC
At stage1 of bootstrapping 4.9.2, I got libgcc configure error (from powerpc-unknown-darwin/libgcc/config.log):

configure:3389: /_gcc_build/./gcc/xgcc -B/_gcc_build/./gcc/ -B/usr/powerpc-unknown-darwin/bin/ -B/usr/powerpc-u$
cc1: internal compiler error: in init_reg_sets, at reginfo.c:178
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:3392: $? = 1
configure:3580: checking for suffix of object files
configure:3602: /_gcc_build/./gcc/xgcc -B/_gcc_build/./gcc/ -B/usr/powerpc-unknown-darwin/bin/ -B/usr/powerpc-u$
cc1: internal compiler error: in init_reg_sets, at reginfo.c:178
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
configure:3606: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3620: error: in `/_gcc_build/powerpc-unknown-darwin/libgcc':
configure:3623: error: cannot compute suffix of object files: cannot compile
Comment 1 Douglas Mencken 2014-10-31 18:38:11 UTC
$ gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=gcc/xgcc
Target: powerpc-unknown-darwin
Configured with: ../gcc-4.9.2/configure --build=powerpc-unknown-darwin --host=powerpc-unknown-darwin --target=powerpc-unknown-darwin --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --with-slibdir=/usr/lib --program-prefix= --enable-languages=c,c++,objc,obj-c++ --disable-checking --enable-shared --enable-static --enable-threads=posix --with-__thread --disable-nls
Thread model: posix
gcc version 4.9.2 (GCC)
Comment 2 Douglas Mencken 2014-10-31 18:43:38 UTC
stage0 ("host") compiler:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-unknown-darwin/4.9.1/lto-wrapper
Target: powerpc-unknown-darwin
Configured with: ../gcc-4.9.1/configure --build=powerpc-unknown-darwin --host=powerpc-unknown-darwin --target=powerpc-unknown-darwin --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --with-slibdir=/usr/lib --program-prefix= --enable-languages=c,c++,objc,obj-c++ --enable-checking=release --enable-stage1-checking --enable-shared --enable-static --enable-threads=posix --with-__thread --with-system-zlib --disable-nls --disable-werror : (reconfigured) ../gcc-4.9.1/configure --build=powerpc-unknown-darwin --host=powerpc-unknown-darwin --target=powerpc-unknown-darwin --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --with-slibdir=/usr/lib --program-prefix= --enable-languages=c,c++,objc,obj-c++ --disable-checking --enable-shared --enable-static --enable-threads=posix --with-__thread --with-system-zlib --disable-nls --disable-werror
Thread model: posix
gcc version 4.9.1 (GCC)
Comment 3 Douglas Mencken 2014-10-31 19:16:43 UTC
Same error when configuring 4.9.2 exactly as host compiler:

../gcc-4.9.2/configure \
--build=powerpc-unknown-darwin --host=powerpc-unknown-darwin --target=powerpc-unknown-darwin \
--prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --with-slibdir=/usr/lib \
--program-prefix= --enable-languages=c,c++,objc,obj-c++ \
--disable-checking \
--enable-shared --enable-static \
--enable-threads=posix --with-__thread --with-system-zlib \
--disable-nls --disable-werror

checking whether ln -s works... yes
checking for powerpc-unknown-darwin-gcc... /_gcc_build/./gcc/xgcc -B/_gcc_build/./gcc/ -B/usr/powerpc-unknown-darwin/bin/ -B/usr/powerpc-unknown-darwin/lib/ -isystem /usr/powerpc-unknown-darwin/include -isystem /usr/powerpc-unknown-darwin/sys-include
checking for suffix of object files... configure: error: in `/_gcc_build/powerpc-unknown-darwin/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Comment 4 Denis Excoffier 2014-11-01 00:24:46 UTC
Me too.

Invocation command line is:

% /tmp/lcl/tmp/gcc/gcc-4.9.2/configure --prefix=/tmp/lcl/uxl/gcc-4.9.2 --disable-multilib --with-local-prefix=/usr/local/nonexistent --enable-languages=c,c++

And compiler is:
% gcc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Near the beginning of config.log, something that could be important:

-----------
/usr/bin/hostinfo      = Mach kernel version:
   Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC
Kernel configured for a single processor only.
1 processor is physically available.
1 processor is logically available.
Processor type: ppc7450 (PowerPC 7450)
Processor active: 0
Primary memory available: 1.00 gigabytes
Default processor set: 53 tasks, 178 threads, 1 processors
----------

I commented out the gcc_assert at line 178. It then continues a little, until in
powerpc-apple-darwin9.8.0/libstdc++-v3 (still stage 1), with an another ICE (Bus error) in guard.cc:114:28.

I also confirm that 4.9.1 compiles (and runs) ok.
Comment 5 Lawrence Velázquez 2014-11-21 19:32:20 UTC
Some MacPorts users are now reporting this.

https://trac.macports.org/ticket/45954
Comment 6 Francois-Xavier Coudert 2014-11-22 16:54:17 UTC
(In reply to Lawrence Velázquez from comment #5)
> Some MacPorts users are now reporting this.

Can you provide a backtrace of the error? In the build directory, run the executable "gcc/cc1" on a test source file (like the empty main program that libgcc configure tries to compile), under the debugger: "lldb -- ./gcc/cc1 test.c"

The debugger starts, then you type "r" (without quotes) and enter. It will stop at the point of failure, then you type "bt" and enter again. Paste here the result of that last command. This will help understand where things are going wrong.
Comment 7 Denis Excoffier 2014-11-23 16:31:08 UTC
(In reply to Francois-Xavier Coudert from comment #6)
There is no lldb here, and also no direct 'bt' available. I used gdb with a break point:

% cd /tmp/lcl/tmp/gcc/obj
%
% grep -n 'gcc_assert (sizeof reg_names == sizeof initial_reg_names)' ../gcc-4.9.2/gcc/reginfo.c
178:  fprintf(stderr, "%s:%u %u %u\n", __FILE__, __LINE__, sizeof reg_names, sizeof initial_reg_names); gcc_assert (sizeof reg_names == sizeof initial_reg_names);
%
% cat test.c
/* nothing */
%
% /usr/bin/cc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

%
% ./gcc/cc1 test.c
/tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/reginfo.c:178 596 468
cc1: internal compiler error: in init_reg_sets, at reginfo.c:178
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
%
% /usr/bin/gdb ./gcc/cc1
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:15:14 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared libraries ...... done

(gdb) break reginfo.c:178
Breakpoint 1 at 0xa4df88: file /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/reginfo.c, line 178.
(gdb) run test.c
Starting program: /Users/denis/darlcl/tmp/gcc/obj/gcc/cc1 test.c
Reading symbols for shared libraries +++++. done

Breakpoint 1, init_reg_sets () at /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/reginfo.c:178
178	  fprintf(stderr, "%s:%u %u %u\n", __FILE__, __LINE__, sizeof reg_names, sizeof initial_reg_names); gcc_assert (sizeof reg_names == sizeof initial_reg_names);
(gdb) bt
#0  init_reg_sets () at /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/reginfo.c:178
#1  0x00b5a074 in general_init (argv0=0xbffff70c "/Users/denis/darlcl/tmp/gcc/obj/gcc/cc1") at /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/toplev.c:1169
#2  0x00b5bda0 in toplev_main (argc=2, argv=0xbffff644) at /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/toplev.c:1961
#3  0x010265fc in main (argc=2, argv=0xbffff644) at /tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/main.c:36
Current language:  auto; currently c++
(gdb) cont
Continuing.
/tmp/lcl/tmp/gcc/gcc-4.9.2/gcc/reginfo.c:178 596 468
cc1: internal compiler error: in init_reg_sets, at reginfo.c:178
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Program exited with code 04.
(gdb) quit
%


Hope this helps,

Denis Excoffier.
Comment 8 Francois-Xavier Coudert 2014-11-23 17:36:34 UTC
I've reproduced this with a cross-compiler targeting powerpc-apple-darwin9: the cc1 built fails at startup, with any source file, as shown above.

Then bisection shows this 4.9.2 regression is due to revision 213597:

2014-08-04  Rohit  <rohitarulraj@freescale.com>
        * config/rs6000/rs6000.c
          (rs6000_reg_names) : Add SPE high register names.
          (alt_reg_names) : Likewise.
          (rs6000_dwarf_register_span) : For SPE high registers, replace
          dwarf register numbers with GCC hard register numbers.
          (rs6000_init_dwarf_reg_sizes_extra) : Likewise.
          (rs6000_dbx_register_number): For SPE high registers, return dwarf
          register number for the corresponding GCC hard register number.

        * config/rs6000/rs6000.h
          (FIRST_PSEUDO_REGISTER) : Update based on 32 newly added GCC hard
          register numbers for SPE high registers.
          (DWARF_FRAME_REGISTERS) :  Likewise.
          (DWARF_REG_TO_UNWIND_COLUMN) : Likewise.
          (DWARF_FRAME_REGNUM) : Likewise.
          (FIXED_REGISTERS) : Likewise.
          (CALL_USED_REGISTERS) : Likewise.
          (CALL_REALLY_USED_REGISTERS) : Likewise.
          (REG_ALLOC_ORDER) : Likewise.
          (enum reg_class) : Likewise.
          (REG_CLASS_NAMES) : Likewise.
          (REG_CLASS_CONTENTS) : Likewise.
          (SPE_HIGH_REGNO_P) : New macro to identify SPE high registers.


I looked into reginfo.c: array initial_reg_names has 117 elements:

static const char *const initial_reg_names[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "mq", "lr", "ctr", "ap", "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "xer", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "vrsave", "vscr", "spe_acc", "spefscr", "sfp", "tfhar", "tfiar", "texasr" };

while reg_names (this_target_hard_regs->x_reg_names) has size FIRST_PSEUDO_REGISTER, which equals 149.
Comment 9 Francois-Xavier Coudert 2014-11-23 17:43:41 UTC
This also affects trunk, rendering the compiler unusable and breaking bootstrap.
Comment 10 Iain Sandoe 2014-11-23 17:59:44 UTC
sorry I fixed this months ago locally..
 I will push a patch to fix ASAP.

note that there are 4 bootstrap breakers on PPC (trunk)
1. this
2. libcc1 (same fail as x86)
3. libiberty needs some options massage to build PIC properly (will also break i686-darwin*)
4. libada is currently looking for __environ and needs a modification to the makefile, affects at least 10.5, 10.6
Comment 11 Francois-Xavier Coudert 2014-11-23 18:07:25 UTC
(In reply to Iain Sandoe from comment #10)
> note that there are 4 bootstrap breakers on PPC (trunk)

More annoying, I think, is that this one is also on 4.9, and actually made it into the 4.9.2 release.
Comment 12 Rohit 2014-11-24 16:31:32 UTC
Created attachment 34100 [details]
Proposed patch

Francois,
Can you please test the attached patch?

2014-11-24  Rohit  <rohitarulraj@freescale.com>

[gcc]
	PR bootstrap/63703
	* config/rs6000/darwin.h (REGISTER_NAMES): Update based on 32 newly
	added GCC hard register numbers for SPE high registers.
Comment 13 Iain Sandoe 2014-11-24 16:48:10 UTC
(In reply to Rohit from comment #12)
> Created attachment 34100 [details]
> Proposed patch

> Can you please test the attached patch?

In this case you could test just by building a cc1 for powerpc-apple-darwin9 X from whatever host you're using - I think that should not take more than 20mins.

> 2014-11-24  Rohit  <rohitarulraj@freescale.com>
> 
> [gcc]
> 	PR bootstrap/63703
> 	* config/rs6000/darwin.h (REGISTER_NAMES): Update based on 32 newly
> 	added GCC hard register numbers for SPE high registers.

that looks pretty much identical to my local patch.
Comment 14 Rohit 2014-11-24 19:07:51 UTC
(In reply to Iain Sandoe from comment #13)
> (In reply to Rohit from comment #12)
> > Created attachment 34100 [details]
> > Proposed patch
> 
> > Can you please test the attached patch?
> 
> In this case you could test just by building a cc1 for powerpc-apple-darwin9
> X from whatever host you're using - I think that should not take more than
> 20mins.

cc1 builds for powerpc-apple-darwin9 without any issues with the attached patch.
But the reported issue was observed while building libgcc.
Comment 15 Misty De Meo 2014-11-25 06:23:03 UTC
I'm able to successfully build all of GCC for powerpc-apple-darwin9 using the proposed patch.
Comment 16 Francois-Xavier Coudert 2014-11-25 19:01:40 UTC
Author: fxcoudert
Date: Tue Nov 25 19:01:08 2014
New Revision: 218058

URL: https://gcc.gnu.org/viewcvs?rev=218058&root=gcc&view=rev
Log:
	PR bootstrap/63703
	* config/rs6000/darwin.h (REGISTER_NAMES): Update based on 32 newly
	added GCC hard register numbers for SPE high registers.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/darwin.h
Comment 17 Francois-Xavier Coudert 2014-11-25 21:42:15 UTC
Author: fxcoudert
Date: Tue Nov 25 21:41:44 2014
New Revision: 218064

URL: https://gcc.gnu.org/viewcvs?rev=218064&root=gcc&view=rev
Log:
	PR bootstrap/63703
	* config/rs6000/darwin.h (REGISTER_NAMES): Update based on 32 newly
	added GCC hard register numbers for SPE high registers.

Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/rs6000/darwin.h
Comment 18 Francois-Xavier Coudert 2014-11-25 21:55:05 UTC
Fix committed to trunk and 4.9 branch, closing as fixed.
Comment 19 Lawrence Velázquez 2014-11-26 03:21:58 UTC
I assume this didn't make it into a 4.8 release?
Comment 20 Lawrence Velázquez 2014-11-26 03:23:10 UTC
(In reply to Lawrence Velázquez from comment #19)
> I assume this didn't make it into a 4.8 release?

That the bug didn't make it, I mean.
Comment 21 Iain Sandoe 2014-11-26 08:11:35 UTC
(In reply to Lawrence Velázquez from comment #20)
> (In reply to Lawrence Velázquez from comment #19)
> > I assume this didn't make it into a 4.8 release?
> 
> That the bug didn't make it, I mean.

The change to add those registers is not on 4.8 branch - this fix isn;t needed there (so far).
Comment 22 Denis Excoffier 2014-11-27 05:47:32 UTC
I'm also happy with the above patch. Thank you.