Bug 37970 - ICE in some (probably mal-formed) template code
Summary: ICE in some (probably mal-formed) template code
Status: RESOLVED DUPLICATE of bug 24791
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-30 23:34 UTC by Keenan Forbes
Modified: 2008-12-30 01:18 UTC (History)
15 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed file for ICE (36.66 KB, text/plain)
2008-10-30 23:35 UTC, Keenan Forbes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keenan Forbes 2008-10-30 23:34:27 UTC
This code (for better or worse) appeared to have built with 4.0.1. By adding the "class" stuff in the template specialization the static member was actually instantiated. With just <> no instantiation occurred.

g++ -v -save-temps -c tmp.cc
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
 /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE tmp.cc -mtune=i686 -fpch-preprocess -o tmp.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2
 /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu
 /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.1.2/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux-gnu/4.1.2/cc1plus -fpreprocessed tmp.ii -quiet -dumpbase tmp.cc -mtune=i686 -auxbase tmp -version -o tmp.s
GNU C++ version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) (i486-linux-gnu)
        compiled by GNU C version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96557
Compiler executable checksum: 183d42a838ed2b7313bffcb8f2f2fda7
tmp.cc: In constructor ‘ChainHashTable<Key, Value, HashFunc>::ChainHashTable() [with Key = const elfsymbol*, Value = CF::ElxrFunction*, HashFunc = elfsymbol_hash]’:
tmp.cc:35:   instantiated from ‘MemoryManager<ChainHashTable<const elfsymbol*, CF::ElxrFunction*, elfsymbol_hash>::Link> ChainHashTable<const elfsymbol*, CF::ElxrFunction*, elfsymbol_hash>::linkmanager’
tmp.cc:35:   instantiated from ‘ChainHashTable<Key, Value, HashFunc>::ChainHashTable() [with Key = const elfsymbol*, Value = CF::ElxrFunction*, HashFunc = elfsymbol_hash]’
tmp.cc:65:   instantiated from here
tmp.cc:35: internal compiler error: in instantiate_decl, at cp/pt.c:11775
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccy7OWHQ.out file, please attach this to your bugreport.


I don't see a way to attach the file, but perhaps that's available after I commit...
Comment 1 Keenan Forbes 2008-10-30 23:35:24 UTC
Created attachment 16591 [details]
preprocessed file for ICE
Comment 2 Volker Reichelt 2008-12-30 01:18:05 UTC
To make things short: The bug is a duplicate of PR24791.

> This code (for better or worse) appeared to have built with 4.0.1. By adding
>the "class" stuff in the template specialization the static member was actually
>instantiated.

The "class stuff" is invalid. As mentioned in PR24791, GCC 4.0.0 -4.0.2 did not crash on the code. All other releases before GCC 4.3.0 did.

> With just <> no instantiation occurred.

Because this is just a declaration and not a definition for the static member.
You need to add an initializer to make it a definition.
Then this should work as expected.


*** This bug has been marked as a duplicate of 24791 ***