From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111094 invoked by alias); 4 Jun 2016 14:44:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 111072 invoked by uid 89); 4 Jun 2016 14:44:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 04 Jun 2016 14:44:05 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BE242AB43; Sat, 4 Jun 2016 14:44:01 +0000 (UTC) User-Agent: K-9 Mail for Android In-Reply-To: <20160604133613.GS7387@tucnak.redhat.com> References: <20160604133613.GS7387@tucnak.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH] Fix ICE with gimple clobber (PR tree-optimization/71405) From: Richard Biener Date: Sat, 04 Jun 2016 14:44:00 -0000 To: Jakub Jelinek CC: gcc-patches@gcc.gnu.org Message-ID: <5EE58F2E-DCB5-40BB-A9ED-046B251224C6@suse.de> X-SW-Source: 2016-06/txt/msg00326.txt.bz2 On June 4, 2016 3:36:13 PM GMT+02:00, Jakub Jelinek wrote: >Hi! > >On this testcase execute_update_addresses_taken creates >VIEW_CONVERT_EXPR of a {CLOBBER}, which is of course invalid. >Instead, this patch just creates {CLOBBER} of the right type and let's >the following ssa update transform that to replacing uses with default >def >or whatever else is appropriate. > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. Thanks, Richard. >2016-06-04 Jakub Jelinek > > PR tree-optimization/71405 > * tree-ssa.c (execute_update_addresses_taken): For clobber with > incompatible type, build a new clobber with the right type instead > of building a VIEW_CONVERT_EXPR around it. > > * g++.dg/torture/pr71405.C: New test. > >--- gcc/tree-ssa.c.jj 2016-05-24 10:56:01.000000000 +0200 >+++ gcc/tree-ssa.c 2016-06-04 11:59:36.561302230 +0200 >@@ -1622,9 +1622,16 @@ execute_update_addresses_taken (void) > if (gimple_assign_lhs (stmt) != lhs > && !useless_type_conversion_p (TREE_TYPE (lhs), > TREE_TYPE (rhs))) >- rhs = fold_build1 (VIEW_CONVERT_EXPR, >- TREE_TYPE (lhs), rhs); >- >+ { >+ if (gimple_clobber_p (stmt)) >+ { >+ rhs = build_constructor (TREE_TYPE (lhs), NULL); >+ TREE_THIS_VOLATILE (rhs) = 1; >+ } >+ else >+ rhs = fold_build1 (VIEW_CONVERT_EXPR, >+ TREE_TYPE (lhs), rhs); >+ } > if (gimple_assign_lhs (stmt) != lhs) > gimple_assign_set_lhs (stmt, lhs); > >--- gcc/testsuite/g++.dg/torture/pr71405.C.jj 2016-06-04 >12:10:33.694768153 +0200 >+++ gcc/testsuite/g++.dg/torture/pr71405.C 2016-06-04 >12:09:28.000000000 +0200 >@@ -0,0 +1,22 @@ >+// PR tree-optimization/71405 >+// { dg-do compile } >+ >+struct C >+{ >+ C () {} >+ int i; >+}; >+ >+void * >+operator new (__SIZE_TYPE__ x, void *y) >+{ >+ return y; >+} >+ >+int >+main () >+{ >+ int a; >+ new (&a) C; >+ return a; >+} > > Jakub