From mboxrd@z Thu Jan 1 00:00:00 1970 From: reichelt@igpm.rwth-aachen.de To: gcc-gnats@gcc.gnu.org Subject: c++/3617: ICE when optimizing templated code Date: Mon, 09 Jul 2001 05:36:00 -0000 Message-id: <20010709122954.22532.qmail@sourceware.cygnus.com> X-SW-Source: 2001-07/msg00215.html List-Id: >Number: 3617 >Category: c++ >Synopsis: ICE when optimizing templated code >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Mon Jul 09 05:36:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Volker Reichelt >Release: gcc 3.0 >Organization: >Environment: i686-pc-linux-gnu, mips-sgi-irix6.5 >Description: When compiling the following lines template struct A { template static void f(T); }; template <> template void A<0>::f(T) {} void g() { A<0>::f(1); } with -O3 turned on I get an ICE: In file included from SpecialBug.cpp:3: SpecialBug.cpp:1: Internal error: Segmentation fault Please submit a full bug report, etc. With -O2 or less the code compiles without problems. In addition the error message itself is a little weird: In spite of the message there is no included file at all. And last but not least, there is one more problem: With g++ 2.95.3 I get the following error message: SpecialBug.cpp:2: template parameters specified in specialization SpecialBug.cpp:2: no `static void A<0>::f(T)' member function declared in class `A<0>' SpecialBug.cpp: In function `static void A<0>::f(T)': SpecialBug.cpp:2: must specialize `struct A<0>' before defining member `static void A<0>::f(T)' So either my code is illegal, in which case we have an additional accepts-illegal bug for 3.0, or the code is legal in fact, in which case we have a rejects-legal bug for 2.95.3. That's about three compiler bugs for three lines of code. Is that a new record? ;-) Greetings, Volker >How-To-Repeat: g++ -O3 -c SpecialBug.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted: