From patchwork Sun Dec 18 21:25:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 132121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0A56CB6FD6 for ; Mon, 19 Dec 2011 08:26:24 +1100 (EST) Received: (qmail 14854 invoked by alias); 18 Dec 2011 21:26:22 -0000 Received: (qmail 14845 invoked by uid 22791); 18 Dec 2011 21:26:21 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 21:26:08 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pBILQ6m1030334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Dec 2011 21:26:07 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pBILQ57Y018924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Dec 2011 21:26:05 GMT Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pBILQ4ps011619; Sun, 18 Dec 2011 15:26:04 -0600 Received: from [192.168.1.4] (/79.56.193.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 18 Dec 2011 13:26:04 -0800 Message-ID: <4EEE5A2F.2020406@oracle.com> Date: Sun, 18 Dec 2011 22:25:03 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] Avoid reporting routines re-entered errors from finish_compound_literal X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, today I was having a look to c++/50855: for the testcase therein currently we are trying to just emit a "sorry, unimplemented: mangling constructor" and bail out. This is actually the case in 4_6-branch. In mainline, instead: 50855.C: In substitution of ‘template decltype ({256}) test(const T&) [with T = char]’: 50855.C:8:14: required from here 50855.C:2:6: warning: narrowing conversion of ‘256’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] 50855.C: In function ‘int main()’: 50855.C:2:6: warning: narrowing conversion of ‘256’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] ‘ Internal compiler error: Error reporting routines re-entered. Now, I don't know if we can get to fixing the substantive issue in time for 4.7.0, but the patchlet below leads to (ie, similarly to 4_6-branch + Wnarrowing): 50855.C: In instantiation of ‘decltype ({256}) test(const T&) [with T = char; decltype ({256}) = char]’: 50855.C:8:14: required from here 50855.C:2:6: warning: narrowing conversion of ‘256’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] 50855.C:2:6: sorry, unimplemented: mangling constructor Tested x86_64-linux. Thanks, Paolo. ///////////////////////////// 2011-12-18 Paolo Carlini * semantics.c (finish_compound_literal): Don't call check_narrowing if !(complain & tf_warning). Index: semantics.c =================================================================== --- semantics.c (revision 182459) +++ semantics.c (working copy) @@ -2370,7 +2370,8 @@ finish_compound_literal (tree type, tree compound_ return error_mark_node; compound_literal = reshape_init (type, compound_literal, complain); if (SCALAR_TYPE_P (type) - && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal)) + && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal) + && (complain & tf_warning)) check_narrowing (type, compound_literal); if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)