From patchwork Fri Mar 2 21:02:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 880899 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-474233-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="Y9mBs/x2"; 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 3ztMFw4JQKz9s7C for ; Sat, 3 Mar 2018 08:02:57 +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=N8bHEDw8ESYVkRjSQZy6cBDLT7PRq4KhnBo0BsK6G5344tuh2Q PT4Ye2EgvCtJtnh9WvGYhnd+3zVxSKJL0zHJRUaNfl4eQb9iW8TCH919VLCCdJ3n CukNza4loeglDKi49VUpPInLhn/Kub22o2x154EUrBzErlExZtJQlnPvA= 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=MGpLYckLYhY8B/AaMkU57hFY8vs=; b=Y9mBs/x2DnGBbPAoLPGz 2k6MOJUt828Nd4uepN/93wiH0llCc7ZKg0KPdWhITAiwnCyYRDyR9O7i6V9y9hf/ n2xBjx6lWUsC5J/mOhPdgX+WhXTpWtX6Kw5MoHu2fBhoj2ie8tvAWzkzGvai2zku /5oCwkRryzUp8Q0Z5gpxF4I= Received: (qmail 90366 invoked by alias); 2 Mar 2018 21:02:50 -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 90357 invoked by uid 89); 2 Mar 2018 21:02:50 -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=exotic X-HELO: aserp2120.oracle.com Received: from aserp2120.oracle.com (HELO aserp2120.oracle.com) (141.146.126.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Mar 2018 21:02:48 +0000 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w22L2ebw006232; Fri, 2 Mar 2018 21:02:46 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2gfbnhrmjm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Mar 2018 21:02:46 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w22L2jPX003253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Mar 2018 21:02:45 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w22L2i4E000916; Fri, 2 Mar 2018 21:02:45 GMT Received: from [192.168.1.4] (/87.11.219.63) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 02 Mar 2018 13:02:44 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 71464 ("[6/7/8 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault") Message-ID: Date: Fri, 2 Mar 2018 22:02:32 +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=8820 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=974 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803020248 X-IsSubscribed: yes Hi, this error recovery ICE happens only with -Os and is just a P5 - on the other hand I would argue the reproducer isn't that exotic! - but seems fixable easily and safely: cdtor_comdat_group immediately calls DECL_ASSEMBLER_NAME on both arguments and of course crashes if they are null. Tested x86_64-linux. Thanks, Paolo. ////////////////// /cp 2018-03-02 Paolo Carlini PR c++/71464 * optimize.c (maybe_thunk_body): When HAVE_COMDAT_GROUP is true, bail out immediately if either fns[1] or fns[0] is null. /testsuite 2018-03-02 Paolo Carlini PR c++/71464 * g++.dg/torture/pr71464.C: New. Index: cp/optimize.c =================================================================== --- cp/optimize.c (revision 258151) +++ cp/optimize.c (working copy) @@ -276,6 +276,9 @@ maybe_thunk_body (tree fn, bool force) { /* At eof, defer creation of mangling aliases temporarily. */ bool save_defer_mangling_aliases = defer_mangling_aliases; + if (!fns[1] || !fns[0]) + /* Can happen during error recovery (c++/71464). */ + return 0; defer_mangling_aliases = true; tree comdat_group = cdtor_comdat_group (fns[1], fns[0]); defer_mangling_aliases = save_defer_mangling_aliases; Index: testsuite/g++.dg/torture/pr71464.C =================================================================== --- testsuite/g++.dg/torture/pr71464.C (nonexistent) +++ testsuite/g++.dg/torture/pr71464.C (working copy) @@ -0,0 +1,7 @@ +struct A {}; + +struct B : virtual A +{ + B () {}; + B () {}; // { dg-error "cannot be overloaded" } +};