internal compiler error: in cxx_eval_indirect_ref, at cp/semantics.c:7435

Bug #1087895 reported by SplinterOfChaos
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.7 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

This error occurs when I try to compile this seven-line file.

#include <tuple>
template< class X > struct Hold {
 X x;
 constexpr Hold( X x ) : x(std::move(x)) { }
};
constexpr auto a = Hold<int>( 1 ); //ok
constexpr auto b = Hold<std::tuple<int>>( std::tuple<int>(1) ); // not

(See compiler output below.)

1) OS Release info:

Description: Ubuntu 12.10
Release: 12.10

2) Gcc version:

g++:
  Installed: 4:4.7.2-1ubuntu2
  Candidate: 4:4.7.2-1ubuntu2
  Version table:
 *** 4:4.7.2-1ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
        100 /var/lib/dpkg/status

3) Expectation:

This will compile such that Hold.x is a tuple<int> that holds just 1. I assume that std::tuple is movable and constexpr.

According to Ideone, GCC 4.5 rejects this, but does not crash. http://ideone.com/17IXz2

4) Actual:

sandbox$ g++ -v -save-temps -std=c++11 test.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-4precise1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-4precise1)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -fstack-protector -o test.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.7
 /usr/include/c++/4.7/x86_64-linux-gnu
 /usr/include/c++/4.7/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test -std=c++11 -version -fstack-protector -o test.s
GNU C++ (Ubuntu/Linaro 4.7.2-4precise1) version 4.7.2 (x86_64-linux-gnu)
 compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.7.2-4precise1) version 4.7.2 (x86_64-linux-gnu)
 compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a1c501d12da152ca643ada9ec378ccab
test.cpp:8:62: in constexpr expansion of 'Hold<std::tuple<int> >(std::tuple<int>((* &1)))'
test.cpp:5:40: in constexpr expansion of '((Hold<std::tuple<int> >*)this)->Hold<std::tuple<int> >::x.std::tuple< <template-parameter-1-1> >::tuple<{int}>((* & std::move<std::tuple<int>&>((* & x))))'
test.cpp:8:62: internal compiler error: in cxx_eval_indirect_ref, at cp/semantics.c:7435
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccebWdLK.out file, please attach this to your bugreport.

I have also produced this with gcc 4.8:

sandbox$ /usr/lib/gcc-snapshot/bin/g++ -v --save-temps -std=c++11 test.cpp
Using built-in specs.
COLLECT_GCC=/usr/lib/gcc-snapshot/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 20121008-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --with-system-zlib --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-snap/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-snap --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-snap --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.0 20121008 (experimental) [trunk revision 192192] (Ubuntu/Linaro 20121008-1ubuntu1)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/cc1plus -E -quiet -v -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -o test.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0
 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/x86_64-linux-gnu/.
 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/backward
 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/include
 /usr/local/include
 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test -std=c++11 -version -o test.s
GNU C++ (Ubuntu/Linaro 20121008-1ubuntu1) version 4.8.0 20121008 (experimental) [trunk revision 192192] (x86_64-linux-gnu)
 compiled by GNU C version 4.8.0 20121008 (experimental) [trunk revision 192192], GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (Ubuntu/Linaro 20121008-1ubuntu1) version 4.8.0 20121008 (experimental) [trunk revision 192192] (x86_64-linux-gnu)
 compiled by GNU C version 4.8.0 20121008 (experimental) [trunk revision 192192], GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: be9316d4d24873f9eb2c1149d4699d98
test.cpp:8:62: in constexpr expansion of 'Hold<std::tuple<int> >(std::tuple<int>((* &1)))'
test.cpp:5:40: in constexpr expansion of '((Hold<std::tuple<int> >*)this)->Hold<std::tuple<int> >::x.std::tuple< <template-parameter-1-1> >::tuple<{int}>((* & std::move<std::tuple<int>&>((* & x))))'
test.cpp:8:62: internal compiler error: in cxx_eval_indirect_ref, at cp/semantics.c:7476
 constexpr auto b = Hold<std::tuple<int>>( std::tuple<int>(1) ); // not
                                                              ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccGrrfHl.out file, please attach this to your bugreport.

Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

Triaged: Trivially repeatable test case

Fails on g++ 4:4.7.2-1ubuntu7 on current Raring.

Changed in gcc-4.7 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
SplinterOfChaos (splinterofchaos) wrote :

Reverted change.

I thought saying "affects gcc-snapshot" would tell Launchpad it "also" affects that, not that it affects that instead.

affects: gcc-4.7 (Ubuntu) → gcc-snapshot (Ubuntu)
affects: gcc-snapshot (Ubuntu) → gcc-4.7 (Ubuntu)
Revision history for this message
SplinterOfChaos (splinterofchaos) wrote :

I submitted this bug to Ubuntu instead of GCC's bugzilla because supposedly that's the propper way to do it in Ubuntu, but I don't see any signs that having done so will help get this bug fixed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.