From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9631 invoked by alias); 5 Jan 2007 14:13:23 -0000 Received: (qmail 9618 invoked by uid 22791); 5 Jan 2007 14:13:23 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.226) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 05 Jan 2007 14:13:16 +0000 Received: by wx-out-0506.google.com with SMTP id h31so6962143wxd for ; Fri, 05 Jan 2007 06:13:14 -0800 (PST) Received: by 10.90.99.20 with SMTP id w20mr653441agb.1168006394362; Fri, 05 Jan 2007 06:13:14 -0800 (PST) Received: by 10.90.120.4 with HTTP; Fri, 5 Jan 2007 06:13:14 -0800 (PST) Message-ID: <24b520d20701050613h10bddaceu567ee42e6b4e111f@mail.gmail.com> Date: Fri, 05 Jan 2007 14:13:00 -0000 From: "Doug Gregor" To: "Brooks Moses" Subject: Re: [PATCH, C++] Make Canonical ICE instead of just warn when mismatching Cc: gcc-patches@gcc.gnu.org In-Reply-To: <459DC221.4030201@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <459DC221.4030201@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-01/txt/msg00382.txt.bz2 On 1/4/07, Brooks Moses wrote: > My impression from your argument is that this case is not like that; > that here we know that a failure to pass this particular internal check > will never result in invalid code. And thus a warning is appropriate > here, because the user will still get valid usable code if they ignore > the warning. > > Is this a correct impression? I haven't seen any mention of this > distinction, but it seems to me that it's the only way that the argument > for a warning instead of a hard error would make sense. Yes, your impression is correct. The canonical types implementation is a compile-time optimization that makes comparing types for equality (e.g., is "int*" the same as "my_int_t*"?) faster. Previously, we would have to look at the structure of the types to determine if they are equivalent; with canonical types, we only do a single pointer comparison. However, the code that looks at the structure of types is still needed for some comparisons, so it's still available for us to use when checking. As it stands now, there is a parameter "verify-canonical-types". When it is zero (the default for --disable-checking builds), we trust the canonical type system to be correct and get our 5-10% speedup on template-heavy code. When it is one (the default for --enable-checking builds), we compare the results of the older, slower structure-based comparison against the results of the canonical type comparison. If they differ, we complain. Then, we can recover from the failure of the canonical-types system by reporting the result that the structure-based comparison determined. Cheers, Doug