From patchwork Wed Mar 21 09:28:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 888654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-475132-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="h5KB5nes"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 405kyr4h2Xz9s16 for ; Wed, 21 Mar 2018 20:29:24 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rrcU9VSrQgDwACDj/ojLI4meDMGWXcxHLV5QoFtVdbGZIlB1Ut Xg6KZAtWJLbMSSsd2cLvZRsEHWfenz0DGgyyiIYct/xFyd7hXhpPq2cNLrQGc2FF 5uP8CCqAt1ntHY5eT2t5c/1hL689t8UCILPUZ0McrjJQ5T8U1zhA3N0Fw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=rgIyRn0CVUjU/XHOkNtMq0izVko=; b=h5KB5nesM/Uw4RpZ1P1b c4z2FvgtWweO2WTFjb5Xdq0mzBFcBv/miFoWkx6cNXezpGQ2Dmqg/M208gIcElcD pwiExbtEfJk86HR04+P5xTrABWtLLnKQTfQ93VuCa1+H6xGKEaQCqs2J9erGRKny 1v7fphs0j3LuXiFVJhqfsYE= Received: (qmail 108895 invoked by alias); 21 Mar 2018 09:29:17 -0000 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 Received: (qmail 108786 invoked by uid 89); 21 Mar 2018 09:29:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*RU:192.168.1.4, H*r:ip*192.168.1.4, Hx-spam-relays-external:192.168.1.4 X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Mar 2018 09:29:03 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2L9P4c1008024; Wed, 21 Mar 2018 09:29:01 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2gumrar0qu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Mar 2018 09:29:01 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2L9T04R014309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Mar 2018 09:29:00 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2L9T097030269; Wed, 21 Mar 2018 09:29:00 GMT Received: from [192.168.1.4] (/80.181.236.138) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 21 Mar 2018 02:29:00 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...") Message-ID: <15cda01c-f6ca-9f33-f9fb-11d5b50b937b@oracle.com> Date: Wed, 21 Mar 2018 10:28:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8838 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 X-IsSubscribed: yes Hi, as I told Marek in the audit trail, I'm working on a more complete patch consistently changing maybe_deduce_size_from_array_init for various error recovery issues (see the trail of c++/84632 too), but since this specific regression ultimately started with a previous change of mine and it's very simple I decided to send it now, for 8.1.0. Essentially, the idea is setting TREE_TYPE (decl) to error_mark_node - the normal error recovery mechanism in this function via cp_complete_array_type - also when the early check_array_designated_initializer fails. Tested x86_64-linux, Paolo. ////////////////////////// /cp 2018-03-21 Paolo Carlini PR c++/84972 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to error_mark_node when check_array_designated_initializer fails. /testsuite 2018-03-21 Paolo Carlini PR c++/84972 * g++.dg/ext/desig10.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 258706) +++ cp/decl.c (working copy) @@ -5467,7 +5467,9 @@ maybe_deduce_size_from_array_init (tree decl, tree failure = 1; } - if (!failure) + if (failure) + TREE_TYPE (decl) = error_mark_node; + else { failure = cp_complete_array_type (&TREE_TYPE (decl), initializer, do_default); Index: testsuite/g++.dg/ext/desig10.C =================================================================== --- testsuite/g++.dg/ext/desig10.C (nonexistent) +++ testsuite/g++.dg/ext/desig10.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/84972 +// { dg-additional-options "-w" } + +char(a[])({.a = 0}); // { dg-error "designated initializer" }