From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1675 invoked by alias); 8 Jun 2007 07:50:04 -0000 Received: (qmail 1583 invoked by uid 48); 8 Jun 2007 07:49:52 -0000 Date: Fri, 08 Jun 2007 07:50:00 -0000 Message-ID: <20070608074952.1582.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ian at airs dot com" 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: 2007-06/txt/msg00543.txt.bz2 ------- Comment #171 from ian at airs dot com 2007-06-08 07:49 ------- Created an attachment (id=13666) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13666&action=view) Patch This variant of the previous patch does better on at least some of the tramp3d functions. Here we eliminate the CHANGE_DYNAMIC_TYPE_EXPR nodes during the first aliasing pass, which prevents them from retaining references to local variables and generally clogging up optimizations. For this test case it generates the same results as mainline, which was not true of the previous patch. typedef __SIZE_TYPE__ size_t; inline void* operator new(size_t, void* __p) throw() { return __p; } template class Vector { public: Vector() { for (int i = 0; i < D; ++i) new (&x_m[i]) T(); } T& operator[](int i) { return x_m[i]; } private: T x_m[D]; }; struct sia { int ai[3]; }; struct s { struct si { sia* p; } asi[3]; float* pd; }; class c { int foo(int, int, int); s sm; }; extern void bar(Vector*, int); int c::foo(int f1, int f2, int f3) { float sum = 0; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { Vector v; v[0] = 1.0; v[1] = 2.0; v[2] = 3.0; for (int k = 0; k < 3; ++k) { float f = (f1 * this->sm.asi[0].p->ai[0] + f2 * this->sm.asi[1].p->ai[0] + f3 * this->sm.asi[2].p->ai[0]); sum += f * v[k]; } *this->sm.pd = sum; } } return sum; } -- ian at airs dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13637|0 |1 is obsolete| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286