From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15955 invoked by alias); 30 Nov 2001 19:20:52 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 15934 invoked from network); 30 Nov 2001 19:20:52 -0000 Received: from unknown (HELO kiruna.synopsys.com) (204.176.20.18) by hostedprojects.ges.redhat.com with SMTP; 30 Nov 2001 19:20:52 -0000 Received: from crone.synopsys.com (crone.synopsys.com [146.225.7.23]) by kiruna.synopsys.com (Postfix) with ESMTP id DF203F337; Fri, 30 Nov 2001 11:20:51 -0800 (PST) Received: from atrus.synopsys.com (localhost [127.0.0.1]) by crone.synopsys.com (8.9.3+Sun/8.9.1) with ESMTP id LAA18228; Fri, 30 Nov 2001 11:20:36 -0800 (PST) From: Joe Buck Received: (from jbuck@localhost) by atrus.synopsys.com (8.9.3+Sun/8.9.1) id LAA00093; Fri, 30 Nov 2001 11:20:51 -0800 (PST) Message-Id: <200111301920.LAA00093@atrus.synopsys.com> Subject: fix for PR 4447: is this really correct? To: gcc@gcc.gnu.org, lerdsuwa@users.sourceforge.net Date: Fri, 23 Nov 2001 14:47:00 -0000 In-Reply-To: <200111291934.LAA07213@atrus.synopsys.com> from "Joe Buck" at Nov 29, 2001 11:34:11 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg01136.txt.bz2 I wrote: > I'd like to see the fix to PR #4447 back-ported from the trunk to 3.0.3. > Actually I don't think any porting is needed, as it's a fix to mangle.c, > which hasn't had many changes; no, it doesn't change the ABI because > hitting the relevant code caused a core dump before. > > This PR is an ICE and a regression from 2.95.x. > I believe that the relevant patch is > > 2001-11-17 Kriang Lerdsuwanakij > > * mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR, > CONST_CAST_EXPR. > * operators.def: Add CAST_EXPR, STATIC_CAST_EXPR, CONST_CAST_EXPR. Mark approved, assuming the usual testing requirements are met. I've now verified that this fix doesn't break any C++ or libstdc++ tests (other tests aren't relevant since this only affects cc1plus). But I am now not sure that this fix is quite correct, though it does improve things. Here's the testcase: ---------------------------------------------- template class T { public: T(int); }; template T<(B1&&B2),I1+I2-int(B1&&B2)> func(T a, T b) { return T<(B1&&B2),I1+I2-int(B1&&B2)> (I1+I2); } void foo(T a, Tb) { func(a, b); } ---------------------------------------------- gcc 3.0 through 3.0.2 get an ICE in the name mangler. With Kriang's patch, the code compiles, but doing nm -p crash.o | c++filt on Solaris gives 0000000000 T foo(T, T) 0000000000 T T<(true)&&(true), ((3)+(4))-(operator int((true)&&(true)))> func(T, T) rather than 0000000000 T foo(T, T) 0000000000 T T func(T, T) as I would expect. It may be that the oddball expression for the return type will not affect correctness and will just contribute to bloat instead (for the purpose of "linkonce" directives, instantiations that are really the same will look different). But it looks wrong. Comments? I may still want this for 3.0.3, because it does make some cases that ICE'd before work correctly (in my fixed-point computation examples the relevant functions are inline so these oddball symbols probably won't even appear). From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Buck To: gcc@gcc.gnu.org, lerdsuwa@users.sourceforge.net Subject: fix for PR 4447: is this really correct? Date: Fri, 30 Nov 2001 11:20:00 -0000 Message-ID: <200111301920.LAA00093@atrus.synopsys.com> References: <200111291934.LAA07213@atrus.synopsys.com> X-SW-Source: 2001-11/msg01637.html Message-ID: <20011130112000.qpVpfKLDHYh2tNwHhGIeLDabE_mMXjC6h6-MLTWKPKM@z> I wrote: > I'd like to see the fix to PR #4447 back-ported from the trunk to 3.0.3. > Actually I don't think any porting is needed, as it's a fix to mangle.c, > which hasn't had many changes; no, it doesn't change the ABI because > hitting the relevant code caused a core dump before. > > This PR is an ICE and a regression from 2.95.x. > I believe that the relevant patch is > > 2001-11-17 Kriang Lerdsuwanakij > > * mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR, > CONST_CAST_EXPR. > * operators.def: Add CAST_EXPR, STATIC_CAST_EXPR, CONST_CAST_EXPR. Mark approved, assuming the usual testing requirements are met. I've now verified that this fix doesn't break any C++ or libstdc++ tests (other tests aren't relevant since this only affects cc1plus). But I am now not sure that this fix is quite correct, though it does improve things. Here's the testcase: ---------------------------------------------- template class T { public: T(int); }; template T<(B1&&B2),I1+I2-int(B1&&B2)> func(T a, T b) { return T<(B1&&B2),I1+I2-int(B1&&B2)> (I1+I2); } void foo(T a, Tb) { func(a, b); } ---------------------------------------------- gcc 3.0 through 3.0.2 get an ICE in the name mangler. With Kriang's patch, the code compiles, but doing nm -p crash.o | c++filt on Solaris gives 0000000000 T foo(T, T) 0000000000 T T<(true)&&(true), ((3)+(4))-(operator int((true)&&(true)))> func(T, T) rather than 0000000000 T foo(T, T) 0000000000 T T func(T, T) as I would expect. It may be that the oddball expression for the return type will not affect correctness and will just contribute to bloat instead (for the purpose of "linkonce" directives, instantiations that are really the same will look different). But it looks wrong. Comments? I may still want this for 3.0.3, because it does make some cases that ICE'd before work correctly (in my fixed-point computation examples the relevant functions are inline so these oddball symbols probably won't even appear).