G++ 3.2 accepts explicit destructor call for incomplete class and silently generates bad code. G++ 2.95.3 does not have this problem. The output is from a linux box. I have also seen this happen with G++ 3.1 & 3.2 on a solaris box. > g++-3.2 -v -Wall -S gccBug.cc Reading specs from /csl/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs Configured with: ./configure --prefix=/csl --program-suffix=-3.2 Thread model: posix gcc version 3.2 /csl/lib/gcc-lib/i686-pc-linux-gnu/3.2/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ gccBug.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase gccBug.cc -Wall -version -o gccBug.s GNU CPP version 3.2 (cpplib) (i386 Linux/ELF) GNU C++ version 3.2 (i686-pc-linux-gnu) compiled by GNU C version 3.2. #include "..." search starts here: #include <...> search starts here: /csl/include/c++/3.2 /csl/include/c++/3.2/i686-pc-linux-gnu /csl/include/c++/3.2/backward /usr/local/include /csl/include /csl/lib/gcc-lib/i686-pc-linux-gnu/3.2/include /csl/i686-pc-linux-gnu/include /usr/include End of search list. Release: 3.2 Environment: Red Hat Linux 7.3 2.96-110 on a P4 How-To-Repeat: class Foo; void bar(void* p) { static_cast<Foo*>(p)->~Foo(); }
Fix: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01840.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. It's a regression.
Responsible-Changed-From-To: unassigned->mmitchel Responsible-Changed-Why: Working on a fix.
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de> To: gcc-gnats@gcc.gnu.org, eker@csl.sri.com, gcc-bugs@gcc.gnu.org, mmitchel@gcc.gnu.org Cc: Subject: Re: c++/8724: [3.2/3.3 regression] explicit destructor call for incomplete class allowed Date: Mon, 13 Jan 2003 01:33:03 +0100 Just for the record: The bug is fixed with the new parser. It's still a 3.2/3.3 regression, though. Regards, Volker http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8724
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de> To: gcc-gnats@gcc.gnu.org, eker@csl.sri.com, gcc-bugs@gcc.gnu.org, mmitchel@gcc.gnu.org Cc: Subject: Re: c++/8724: [3.2 regression] explicit destructor call for incomplete class allowed Date: Mon, 10 Mar 2003 13:01:06 +0100 (CET) Just for the record: The problem seems to be fixed on the 3.3 branch (as well as on mainline). It just remains open on the 3.2 branch. Regards, Volker http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8724
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3.