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++/11148] New: Incorrect codegen for explicit template instantiation, with ICE for error cases


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Incorrect codegen for explicit template instantiation,
                    with ICE for error cases
           Product: gcc
           Version: 3.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: oneill+gccbugs@cs.hmc.edu
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

The following code generates no output in GCC 3.3, and correct output for 3.2.3

--- Begin Sample Code ---------------------
template <typename X>
class Foo {
    int i;
public:
    Foo() {
#ifdef KILL_GCC_3_3
        X::explode();
#endif
    }
};

class Bar {
    Foo<int> foo_;
public:
    Bar() {}
};

template class Foo<int>;

--- End Sample Code -----------------------


If compiled with -DKILL_GCC_3_3, instead of reporting the error

buglet.cc: In constructor `Foo<X>::Foo() [with X = int]':
buglet.cc:11:   instantiated from here
buglet.cc:5: `int' is not an aggregate type

(which is what 3.2.1 does) it dies with

buglet.cc: In constructor `Foo<X>::Foo() [with X = int]':
buglet.cc:11:   instantiated from here
buglet.cc:5: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Verified on Linux and Mac OS X.

linux% gcc -v
Reading specs from /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr/local/gcc-3.3 --enable-languages=c,c++
Thread model: posix
gcc version 3.3

osx% gcc -v
Reading specs from /usr/local/gcc/lib/gcc-lib/powerpc-apple-darwin6.6/3.3/specs
Configured with: ../gcc-3.3/configure --prefix /usr/local/gcc --enable-languages=c,c++
Thread model: single
gcc version 3.3


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