Bug 33324 - [4.3 Regression] ICE on new array of objects with virtual destructors.
Summary: [4.3 Regression] ICE on new array of objects with virtual destructors.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: David Daney
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-09-06 18:48 UTC by David Daney
Modified: 2007-09-09 23:33 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: armv5tl-none-linuxeabi
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2007-09-07 21:30:04


Attachments
Proposed patch. (340 bytes, patch)
2007-09-07 21:16 UTC, David Daney
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Daney 2007-09-06 18:48:22 UTC
On the trunk r128169, configured thusly:

$ ../clean/configure --target=armv5tl-montavista-linuxeabi --prefix=/home/daney/mvl_ti/gcj --with-sysroot=/home/daney/mvl_ti/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/target --enable-languages=c,c++ --with-float=soft --disable-java-awt --without-x --disable-jvmpi --enable-__cxa_atexit --disable-sjlj-exceptions

I get the following ICE:

$ /home/daney/gccsvn/arm-clean/gcc/g++ -B/home/daney/gccsvn/arm-clean/gcc/ -S foo.cc
foo.cc: In constructor ‘C::C(int)’:
foo.cc:15: internal compiler error: in build2_stat, at tree.c:3110
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

There is no ICE on i686-pc-linux-gnu native build.

Test case:

----foo.cc-----------
class A
{
public:
    virtual ~A(){};
};

class C
{
public:
    A *q;

public:	
    C(int x)
    {
        q = new A[x];
    }
};
--------------------
Comment 1 Andrew Pinski 2007-09-06 18:54:24 UTC
This is most likely my fault.
Comment 2 David Daney 2007-09-07 21:16:43 UTC
Created attachment 14171 [details]
Proposed patch.
Comment 3 David Daney 2007-09-07 21:30:04 UTC
I might as well accept the bug as I am testing the fix...
Comment 4 David Daney 2007-09-09 23:31:46 UTC
Subject: Bug 33324

Author: daney
Date: Sun Sep  9 23:31:35 2007
New Revision: 128312

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128312
Log:
	PR c++/33324
	* init.c (build_new_1):  Use POINTER_PLUS_EXPR instead of MINUS_EXPR
	to calculate cookie_ptr.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c

Comment 5 David Daney 2007-09-09 23:33:25 UTC
Now fixed by the patch.
Comment 6 patchapp@dberlin.org 2007-09-10 02:40:56 UTC
Subject: Bug number PR 33324

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00704.html