public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50531] New: ICE on defaulted template destructor
@ 2011-09-27 11:54 bepaald at yahoo dot com
2011-09-27 12:32 ` [Bug c++/50531] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: bepaald at yahoo dot com @ 2011-09-27 11:54 UTC (permalink / raw)
To: gcc-bugs
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 <typename T>
class DataFilter
{
public:
inline virtual ~DataFilter();
virtual void dataUpdate(int, int) = 0;
virtual void dataStart(int, int);
};
template<typename T>
inline DataFilter<T>::~DataFilter() = default;
#endif
//-- arcalculator.h --
#ifndef ARCALCULATOR_H_
#define ARCALCULATOR_H_
#include "datafilter.h"
class ARCalculator : public DataFilter<ARCalculator>
{
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<T>::~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 <http://bugzilla.redhat.com/bugzilla> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/50531] ICE on defaulted template destructor
2011-09-27 11:54 [Bug c++/50531] New: ICE on defaulted template destructor bepaald at yahoo dot com
@ 2011-09-27 12:32 ` redi at gcc dot gnu.org
2011-10-18 19:36 ` [Bug c++/50531] [C++0x] " jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-27 12:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50531
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011-09-27
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-27 11:55:48 UTC ---
reduced:
template <typename T>
class DataFilter
{
public:
inline virtual ~DataFilter();
};
template<typename T>
inline DataFilter<T>::~DataFilter() = default;
class ARCalculator : public DataFilter<ARCalculator>
{
public:
virtual void dataStart(int, int);
};
void ARCalculator::dataStart(int, int)
{}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/50531] [C++0x] ICE on defaulted template destructor
2011-09-27 11:54 [Bug c++/50531] New: ICE on defaulted template destructor bepaald at yahoo dot com
2011-09-27 12:32 ` [Bug c++/50531] " redi at gcc dot gnu.org
@ 2011-10-18 19:36 ` jason at gcc dot gnu.org
2011-10-18 19:37 ` jason at gcc dot gnu.org
2011-10-19 3:21 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-18 19:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50531
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-18 19:36:34 UTC ---
Author: jason
Date: Tue Oct 18 19:36:29 2011
New Revision: 180163
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180163
Log:
PR c++/50531
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/defaulted32.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/pt.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-18 19:36:34 UTC ---
Author: jason
Date: Tue Oct 18 19:36:28 2011
New Revision: 180162
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180162
Log:
PR c++/50531
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/defaulted32.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/50531] [C++0x] ICE on defaulted template destructor
2011-09-27 11:54 [Bug c++/50531] New: ICE on defaulted template destructor bepaald at yahoo dot com
2011-09-27 12:32 ` [Bug c++/50531] " redi at gcc dot gnu.org
2011-10-18 19:36 ` [Bug c++/50531] [C++0x] " jason at gcc dot gnu.org
@ 2011-10-18 19:37 ` jason at gcc dot gnu.org
2011-10-19 3:21 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-18 19:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50531
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-18 19:36:34 UTC ---
Author: jason
Date: Tue Oct 18 19:36:29 2011
New Revision: 180163
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180163
Log:
PR c++/50531
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/defaulted32.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/pt.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-18 19:36:34 UTC ---
Author: jason
Date: Tue Oct 18 19:36:28 2011
New Revision: 180162
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180162
Log:
PR c++/50531
* pt.c (instantiate_decl): Recognize when a function defaulted
outside the class is already instantiated.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/defaulted32.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/50531] [C++0x] ICE on defaulted template destructor
2011-09-27 11:54 [Bug c++/50531] New: ICE on defaulted template destructor bepaald at yahoo dot com
` (2 preceding siblings ...)
2011-10-18 19:37 ` jason at gcc dot gnu.org
@ 2011-10-19 3:21 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-19 3:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50531
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.6.2
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-19 03:20:52 UTC ---
Fixed for 4.6.2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-19 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-27 11:54 [Bug c++/50531] New: ICE on defaulted template destructor bepaald at yahoo dot com
2011-09-27 12:32 ` [Bug c++/50531] " redi at gcc dot gnu.org
2011-10-18 19:36 ` [Bug c++/50531] [C++0x] " jason at gcc dot gnu.org
2011-10-18 19:37 ` jason at gcc dot gnu.org
2011-10-19 3:21 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).