From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27510 invoked by alias); 27 Sep 2011 11:38:34 -0000 Received: (qmail 27329 invoked by uid 22791); 27 Sep 2011 11:38:33 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX,TW_GC,TW_IB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Sep 2011 11:38:14 +0000 From: "bepaald at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50531] New: ICE on defaulted template destructor Date: Tue, 27 Sep 2011 11:54:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bepaald at yahoo dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg02024.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50531 Bug #: 50531 Summary: ICE on defaulted template destructor Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: bepaald@yahoo.com Created attachment 25370 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25370 Preprocessed source that triggers ICE In a program I'm writing I encoutered dozens of ICEs due to bug 49507. After upgrading to 4.6.1, all but one disappeared. The following code shows an example. //-- datafilter.h -- #ifndef DATAFILTER_H_ #define DATAFILTER_H_ template class DataFilter { public: inline virtual ~DataFilter(); virtual void dataUpdate(int, int) = 0; virtual void dataStart(int, int); }; template inline DataFilter::~DataFilter() = default; #endif //-- arcalculator.h -- #ifndef ARCALCULATOR_H_ #define ARCALCULATOR_H_ #include "datafilter.h" class ARCalculator : public DataFilter { public: ARCalculator() = default; // the function declared first will generate an ICE virtual void dataStart(int, int); virtual void dataUpdate(int, int); }; #endif //-- datastart.cc -- #include "arcalculator.h" void ARCalculator::dataStart(int, int) {} //-- dataupdate.cc -- #include "arcalculator.h" void ARCalculator::dataUpdate(int, int) {} Strangely, even though the two functions (dataStart and dataUpdate) are identical, one will compile fine while the other generates an ICE: $ g++ -c -std=c++0x -Wall -Wextra -save-temps dataupdate.cc # compiles fine $ g++ -c -std=c++0x -Wall -Wextra -save-temps datastart.cc # generates ICE In file included from arcalculator.h:4:0, from datastart.cc:1: datafilter.h: In destructor 'DataFilter::~DataFilter() [with T = ARCalculator]': arcalculator.h:5:7: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Preprocessed source stored into /tmp/cccoDyUu.out file, please attach this to your bugreport. $ By switching the declarations of dataStart() and dataUpdate() in arcalculator.h, the source which gives the error is also switched: whichever function is declared first in the header, will generate the ICE when compiled. g++ version info: $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.1/lto-wrapper Target: i686-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux Thread model: posix gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) Preprocessed source is attached.