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++/14967] New: [3.3 regression] ICE with templates and exceptions


+ On a SuSE Linux 9.0 system (GCC version: 3.3.1 (SuSE Linux)), the following
code causes an ICE: Segmentation fault:

$ cat ice.cc 
template< typename T >
struct S1
{
    struct S2 {  };

    S1()
    {
        throw S2();
    }
};

template< typename U >
S1< U > f()
{
    try
    {
        S1< U > s;
        return s;
    }
    catch (typename S1< U >::S2 e)  // If 'e' is a reference, the ICE goes away.
    {

    }
}

int main()
{
    S1< int > si = f< int >();
    return 0;
}

$ g++ -v ice.cc 
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man
--libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --disable-checking
--enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.1 (SuSE Linux)
 /usr/lib/gcc-lib/i586-suse-linux/3.3.1/cc1plus -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D_GNU_SOURCE ice.cc -D__GNUG__=3
-quiet -dumpbase ice.cc -auxbase ice -version -o /tmp/ccFwgjP8.s
GNU C++ version 3.3.1 (SuSE Linux) (i586-suse-linux)
        compiled by GNU C version 3.3.1 (SuSE Linux).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64342
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/i586-suse-linux
 /usr/include/g++/backward
 /usr/local/include
 /usr/lib/gcc-lib/i586-suse-linux/3.3.1/include
 /usr/i586-suse-linux/include
 /usr/include
End of search list.
ice.cc:31: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.suse.de/feedback> for instructions.


+ This code compiles fine on a Red Hat Linux 8.0 system (GCC version: 3.2
20020903 (Red Hat Linux 8.0 3.2-7)):

$ g++ -v ice.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
 /usr/lib/gcc-lib/i386-redhat-linux/3.2/cc1plus -v -D__GNUC__=3
-D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__
-Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__
-D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1
-D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__
-D__tune_i386__ ice.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet
-dumpbase ice.cc -version -o /tmp/ccjnKwBb.s
GNU CPP version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) (i386-redhat-linux)
        compiled by GNU C version 3.2 20020903 (Red Hat Linux 8.0 3.2-7).
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.2
 /usr/include/c++/3.2/i386-redhat-linux
 /usr/include/c++/3.2/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.2/include
 /usr/include
End of search list.
 as -V -Qy -o /tmp/ccGHWiyh.o /tmp/ccjnKwBb.s
GNU assembler version 2.13.90.0.2 (i386-redhat-linux) using BFD version
2.13.90.0.2 20020802
 /usr/lib/gcc-lib/i386-redhat-linux/3.2/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crt1.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crti.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2/crtbegin.o
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2
-L/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../.. /tmp/ccGHWiyh.o -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc-lib/i386-redhat-linux/3.2/crtend.o
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crtn.o

-- 
           Summary: [3.3 regression] ICE with templates and exceptions
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jboyden at geosci dot usyd dot edu dot au
                CC: gcc-bugs at gcc dot gnu dot org


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


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