From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8726 invoked by alias); 26 Apr 2012 12:00:12 -0000 Received: (qmail 8714 invoked by uid 22791); 26 Apr 2012 12:00:11 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Apr 2012 11:59:59 +0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/51712] -Wtype-limits should not trigger for types of implementation-defined signedness Date: Thu, 26 Apr 2012 12:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2012-04/txt/msg02333.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51712 --- Comment #7 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2012-04-26 11:59:30 UTC --- (In reply to comment #6) > On Tue, 17 Apr 2012, manu at gcc dot gnu.org wrote: >=20 > > Unfortunately, I cannot see any way to know that FOO is a constant that= comes > > from an enum. Joseph, is this possible to do in the C FE?=20 >=20 > The original types of expressions that came from enums are already tracke= d=20 > for use of -Wc++-compat (checking if C code is compatible with stricter=20 > C++ rules for enums). (This is what c-typeck.c:build_external_ref uses=20 > the type pointer for: storing the original type of an enum.) So the=20 > information is available in at least parts of the C front end. I see two ways to implement this: * Make build_binary_op take c_expr instead of trees. This will require addi= ng c_expr to the C++ FE. For now, the C++ FE will just encapsulate the trees i= nto c_expr before calling build_binary_op and nothing else. If the long-term g= oal is that C/C++ FEs track the original source code more faithfully, I think t= his is the right step. The use of c_expr should help to achieve this. * Pass 4 more arguments to build_binary_op, one for each c_expr and add a wrapper to avoid changing the interface for C++ FE. This restricts the chan= ges to the C FE (and c-common.c) but it is really ugly. Joseph/Jason, what do you think?