Bug 8724

Summary: [3.2 regression] explicit destructor call for incomplete class allowed
Product: gcc Reporter: eker
Component: c++Assignee: Mark Mitchell <mmitchel>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, jbuck, reichelt
Priority: P3 Keywords: accepts-invalid
Version: 3.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description eker 2002-11-26 12:06:00 UTC
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();
}
Comment 2 Wolfgang Bangerth 2002-11-26 12:16:33 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. It's a regression.
Comment 3 Mark Mitchell 2002-12-17 14:12:40 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 4 Volker Reichelt 2003-01-13 01:33:03 UTC
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
 
 

Comment 5 Volker Reichelt 2003-03-10 13:01:06 UTC
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
 
 
Comment 6 Joe Buck 2003-04-25 21:06:35 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.