Bug 51432 - [4.6 regression] ICE in -flto -std=c++0x -g with cross-compiler
Summary: [4.6 regression] ICE in -flto -std=c++0x -g with cross-compiler
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: 4.7.3
Assignee: Not yet assigned to anyone
URL:
Keywords: lto
: 49433 (view as bug list)
Depends on:
Blocks: 47819
  Show dependency treegraph
 
Reported: 2011-12-06 03:21 UTC by Tomohiro Kashiwada
Modified: 2013-05-25 08:59 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-04-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomohiro Kashiwada 2011-12-06 03:21:02 UTC
in this command:

$ rx-elf-g++ -v
Using built-in specs.
COLLECT_GCC=rx-elf-gcc
COLLECT_LTO_WRAPPER=/home/kikairoya/gcc/libexec/gcc/rx-elf/4.6.1/lto-wrapper
Target: rx-elf
Configured with: /home/kikairoya/repos/gcc/configure --target=rx-elf --prefix=/home/kikairoya/gcc --disable-nls --enable-target-optspace --with-newlib --enable-languages=c,c++ --without-ppl --enable-checking=release
Thread model: single
gcc version 4.6.2 (GCC)

$ rx-elf-g++ -flto -std=c++0x -g -xc++ /dev/null -include functional
In file included from /home/kikairoya/gcc/lib/gcc/rx-elf/4.6.2/../../../../rx-elf/include/c++/4.6.2/functional:59:0,
                 from <command-line>:0:
/home/kikairoya/gcc/lib/gcc/rx-elf/4.6.2/../../../../rx-elf/include/c++/4.6.2/bits/functional_hash.h: In instantiation of 'std::size_t std::hash<_Tp>::operator()(_Tp) const [with _Tp = long double, std::size_t = long unsigned int]':
/home/kikairoya/gcc/lib/gcc/rx-elf/4.6.2/../../../../rx-elf/include/c++/4.6.2/functional:2267:1:   instantiated from here
/home/kikairoya/gcc/lib/gcc/rx-elf/4.6.2/../../../../rx-elf/include/c++/4.6.2/bits/functional_hash.h:184:5: internal compiler error: in write_builtin_type, at cp/mangle.c:2168
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.




ICE occurs not only rx-elf but also sh-elf, m32c-elf, h8300-elf. No error in x86_64-linux-gnu.

no problem if -fno-lto or -gstabs.

This problem appears since r173860 (PR lto/48207).
Comment 1 Jakub Jelinek 2012-03-01 14:39:26 UTC
GCC 4.6.3 is being released.
Comment 2 linzj 2012-04-18 03:02:29 UTC
As I checked,this bug remained in the version 4.6.3
Comment 3 Michael Hope 2012-09-10 03:59:49 UTC
The fault also happens natively:

cbuild@ursa2:~$ g++ -flto -std=c++0x -g -xc++ /dev/null -include functional
In file included from /usr/include/c++/4.6/functional:59:0,
                 from <command-line>:0:
/usr/include/c++/4.6/bits/functional_hash.h: In instantiation of 'std::size_t std::hash<_Tp>::operator()(_Tp) const [with _Tp = long double, std::size_t = unsigned int]':
/usr/include/c++/4.6/functional:2267:1:   instantiated from here
/usr/include/c++/4.6/bits/functional_hash.h:184:5: internal compiler error: in write_builtin_type, at cp/mangle.c:2168

cbuild@ursa2:~$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

This isn't FSF 4.6.3 but is pretty close.
Comment 4 Jakub Jelinek 2013-04-12 15:57:48 UTC
The 4.6 branch has been closed, does this problem exists also in 4.7.3 or later?
Comment 5 Tomohiro Kashiwada 2013-04-16 03:33:22 UTC
no problem at gcc-4.7.3. it works fine.

$ rx-elf-g++ -v
Using built-in specs.
COLLECT_GCC=rx-elf-g++
COLLECT_LTO_WRAPPER=/home/kikairoya/rx/libexec/gcc/rx-elf/4.7.3/lto-wrapper
Target: rx-elf
Configured with: /home/kikairoya/sources/gcc-4.7.3/configure --prefix=/home/kikairoya/rx --target=rx-elf --disable-nls --enable-target-optspace --with-newlib --enable-languages=c,c++ --without-ppl --enable-checking=release
Thread model: single
gcc version 4.7.3 (GCC)

$ rx-elf-g++ -flto -std=c++0x -g -xc++ /dev/null -include functional
/home/kikairoya/rx/lib/gcc/rx-elf/4.7.3/../../../../rx-elf/lib/crt0.o: In function `L0':
/home/kikairoya/sources/newlib-1.20.0/libgloss/rx/crt0.S:77: undefined reference to `_main'
/home/kikairoya/rx/lib/gcc/rx-elf/4.7.3/../../../../rx-elf/bin/ld: /home/kikairoya/rx/lib/gcc/rx-elf/4.7.3/../../../../rx-elf/lib/crt0.o(P): error: call to undefined function '_main'
collect2: error: ld returned 1 exit status
Comment 6 Jakub Jelinek 2013-04-16 05:55:08 UTC
Fixed in 4.7.3 then.
Comment 7 Paolo Carlini 2013-05-25 08:59:58 UTC
*** Bug 49433 has been marked as a duplicate of this bug. ***