From patchwork Fri Mar 9 18:06:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 883922 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-474516-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bpHe5u5Q"; 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 3zybfv4HZJz9sYY for ; Sat, 10 Mar 2018 05:35:49 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=RJXm1qhIcBpRZ/HmpnQeYZoG2eeEj e+sy/H/2rkJEYnLZ3lMgtquoWeo2zmXf4btYXMF2Yv8gfCMDybLzau+UGGd5RqEj 6OYlHLjp1pga/OK2Vu/3mV9xgFyfXptPvSUhVCPtfnnjETpcSRfq6/27YFyyhSki dHkS6HIQJ14iuM= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=TlOtrSogusxynrjcbQUyVLDKvF4=; b=bpH e5u5Qj4SxPzKSnBV069eTDRwwxzcGpU0md+XB/c3Ofmm8TVWwaenzG4UbdvM4ZBL obtzGJUaVGxty/lvaPH4aHmLe5rzICfBfSFSu6VKwNpqv2KAKHEuI+UfU9GUHSqR zMrAZmG+htS+Si7rlPzu7aCCPPd0TbJ1ubnTJEeM= Received: (qmail 35045 invoked by alias); 9 Mar 2018 18:35:43 -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 35034 invoked by uid 89); 9 Mar 2018 18:35:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=11927 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Mar 2018 18:35:41 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 574A1EBFEF for ; Fri, 9 Mar 2018 18:35:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.110]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E0FB6F9E4 for ; Fri, 9 Mar 2018 18:35:28 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id w29I6Fsf027471; Fri, 9 Mar 2018 19:06:15 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w29I6Ek7027470; Fri, 9 Mar 2018 19:06:14 +0100 Date: Fri, 9 Mar 2018 19:06:14 +0100 From: Jakub Jelinek To: Richard Biener , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix tree-inline.c INDIRECT_REF handling (PR c++/84767) Message-ID: <20180309180614.GG8577@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes Hi! On the following testcase we ICE because when cloning the ctor using tree-inline.c infrastructure we don't remap the type of INDIRECT_REF, which needs to be remapped if it a variable length type, otherwise we refer to the parameters of the original ctor rather than of the base or complete ctor. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-03-09 Jakub Jelinek PR c++/84767 * tree-inline.c (copy_tree_body_r): For INDIRECT_REF of a remapped decl, use remap_type if we want to use the type. * g++.dg/ext/vla18.C: New test. Jakub --- gcc/tree-inline.c.jj 2018-02-13 21:21:38.000000000 +0100 +++ gcc/tree-inline.c 2018-03-09 13:05:10.355154860 +0100 @@ -1192,6 +1192,7 @@ copy_tree_body_r (tree *tp, int *walk_su *tp = gimple_fold_indirect_ref (ptr); if (! *tp) { + type = remap_type (type, id); if (TREE_CODE (ptr) == ADDR_EXPR) { *tp --- gcc/testsuite/g++.dg/ext/vla18.C.jj 2018-03-09 13:11:27.863229118 +0100 +++ gcc/testsuite/g++.dg/ext/vla18.C 2018-03-09 13:10:54.319222521 +0100 @@ -0,0 +1,19 @@ +// PR c++/84767 +// { dg-do compile } +// { dg-options "" } + +int v[1][10]; + +struct A +{ + A (int); +}; + +A::A (int i) +{ + typedef int T[1][i]; + T *x = (T *) v; + (*x)[0][0] = 0; +} + +A a = 10;