This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/40013] New: [4.4 regression] ICE when creating a local array with size from the return value of a member function of an object in a nested class in a template class


I get an ICE when compiling this code using GCC 4.4 from svn:

template <class I> class TestClass {
public:
        struct Subclass { struct { int c() {return 0;} } b; };
        void test();
};
template <class I> void TestClass<I>::test() {
        Subclass a;
        int d[a.b.c()];
}
int main() {
        TestClass<char> that;
        that.test();
}

goffrie@asplode tmp % g++ -v testcase.cpp -o testcase --save-temps
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.4.1_pre9999/work/gcc-4.4.1-9999/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.1-pre9999
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1-pre9999
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1-pre9999/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.1-pre9999/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --enable-nls --without-included-gettext
--with-system-zlib --disable-checking --disable-werror --enable-secureplt
--enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp
--enable-cld --disable-libgcj --enable-languages=c,c++,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo SVN' --with-ppl
--with-cloog
Thread model: posix
gcc version 4.4.1-pre9999 built 20090502 (prerelease) rev. 147067 (Gentoo SVN) 
COLLECT_GCC_OPTIONS='-v' '-o' 'testcase' '-save-temps' '-shared-libgcc'
'-mtune=generic'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/cc1plus -E -quiet -v
-D_GNU_SOURCE testcase.cpp -mtune=generic -fpch-preprocess -o testcase.ii
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include/g++-v4

/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include/g++-v4/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include/g++-v4/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-o' 'testcase' '-save-temps' '-shared-libgcc'
'-mtune=generic'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.1-pre9999/cc1plus -fpreprocessed
testcase.ii -quiet -dumpbase testcase.cpp -mtune=generic -auxbase testcase
-version -o testcase.s
GNU C++ (Gentoo SVN) version 4.4.1-pre9999 built 20090502 (prerelease) rev.
147067 (x86_64-pc-linux-gnu)
        compiled by GNU C version 4.4.1-pre9999 built 20090502 (prerelease)
rev. 147067, GMP version 4.3.0, MPFR version 2.4.1-p5.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128109
Compiler executable checksum: 0168ca3d6bfe22e6160ea49ab7a5ec7b
testcase.cpp: In member function â??void TestClass<I>::test() [with I =
char]â??:
testcase.cpp:12:   instantiated from here
testcase.cpp:8: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.

It works fine with Gentoo's GCC 4.3.3-r2. I don't know if their patches affect
this, though.

This causes Dillo to fail to compile on its "dw/fltkui.cc".


-- 
           Summary: [4.4 regression] ICE when creating a local array with
                    size from the return value of a member function of an
                    object in a nested class in a template class
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: goffrie at gmail dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40013


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]