[Bug c++/20428] New: ICE for local class in a function template

j-wang3 at northwestern dot edu gcc-bugzilla@gcc.gnu.org
Fri Mar 11 17:42:00 GMT 2005


Keyword (?):
ice-on-valid-code

GCC versions tested:

GNU C++ version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.3.3 (SuSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129465

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).

GNU C++ version 3.4.2 (mingw-special) (mingw32)
        compiled by GNU C version 3.4.2 (mingw-special).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65398

Source file that causes ICE:
************* buggy.cpp ********************************

struct buggy_i
{
    virtual void release() = 0;

protected:
    ~buggy_i() {}
};

template <class T>
buggy_i *test(T i)
{
    struct test_t : public buggy_i
    {
        T i_;
		
        virtual void release() {delete this;}
		
        test_t(T i) : i_(i) {}
    };
	
    return new test_t(i);
}

int main(int argc, char *argv[])
{
    buggy_i *p = test(10);

    return 0;
}
*********************************************************

Detailed output for the version 3.4.1:
(Other versions give exactly the same ICE message.)

XXXXXXXXXXXXXX> g++ -v -c buggy.cpp
Reading specs from /usr/local/unison/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ./configure --prefix=/usr/local/unison : 
(reconfigured) ./configure --prefix=/usr/local/unison --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1
 /usr/local/unison/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -quiet -v -
D_GNU_SOURCE buggy.cpp -quiet -dumpbase buggy.cpp -mtune=pentiumpro -auxbase 
buggy -version -o /tmp/ccEIMEQg.s
ignoring nonexistent directory "/usr/local/unison/lib/gcc/i686-pc-linux-
gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/unison/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1
 /usr/local/unison/lib/gcc/i686-pc-linux-
gnu/3.4.1/../../../../include/c++/3.4.1/i686-pc-linux-gnu
 /usr/local/unison/lib/gcc/i686-pc-linux-
gnu/3.4.1/../../../../include/c++/3.4.1/backward
 /usr/local/include
 /usr/local/unison/include
 /usr/local/unison/lib/gcc/i686-pc-linux-gnu/3.4.1/include
 /usr/include
End of search list.
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.3.3 (SuSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129465
buggy.cpp: In member function `void test(T)::test_t::release() [with T = int]':
buggy.cpp:28:   instantiated from here
buggy.cpp:16: internal compiler error: in find_function_data, at function.c:315
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

-- 
           Summary: ICE for local class in a function template
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: j-wang3 at northwestern dot edu
                CC: gcc-bugs at gcc dot gnu dot org,j-wang3 at northwestern
                    dot edu


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



More information about the Gcc-bugs mailing list