From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34327 invoked by alias); 23 Mar 2015 20:01:41 -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 34312 invoked by uid 89); 23 Mar 2015 20:01:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.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; Mon, 23 Mar 2015 20:01:39 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CCC4375017; Mon, 23 Mar 2015 20:01:36 +0000 (UTC) User-Agent: K-9 Mail for Android In-Reply-To: <20150323195454.GA1746@tucnak.redhat.com> References: <20150323195454.GA1746@tucnak.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH] Fix a -fcheck-pointer-bounds -mmpx ICE (PR target/65523) From: Richard Biener Date: Mon, 23 Mar 2015 20:01:00 -0000 To: Jakub Jelinek ,Ilya Enkovich CC: gcc-patches@gcc.gnu.org Message-ID: <2ADA2E1B-9037-4444-8D8F-B9BAB3AE63A5@suse.de> X-SW-Source: 2015-03/txt/msg01217.txt.bz2 On March 23, 2015 8:54:54 PM GMT+01:00, Jakub Jelinek wrote: >Hi! > >On the following testcase we ICE, because we don't verify we have the >ERF_RETURNS_ARG argument, on non-verified builtins that is possible. >Other uses of ERF_RETURNS_ARG seem to verify it. >Also, there was an unneeded extra gimple_call_return_flags call, >the condition has already checked that ERF_RETURNS_ARG flag is set. > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. Thanks, Richard. >2015-03-23 Jakub Jelinek > > PR target/65523 > * tree-chkp.c (chkp_build_returned_bound): Ignore > ERF_RETURNS_ARG calls if they have fewer than needed arguments. > > * gcc.target/i386/pr65523.c: New test. > >--- gcc/tree-chkp.c.jj 2015-03-09 08:05:05.000000000 +0100 >+++ gcc/tree-chkp.c 2015-03-23 14:37:52.469289930 +0100 >@@ -2153,6 +2153,7 @@ chkp_build_returned_bound (gcall *call) > tree bounds; > gimple stmt; > tree fndecl = gimple_call_fndecl (call); >+ unsigned int retflags; > > /* To avoid fixing alloca expands in targets we handle > it separately. */ >@@ -2196,12 +2197,11 @@ chkp_build_returned_bound (gcall *call) > } > /* Do not use retbnd when returned bounds are equal to some > of passed bounds. */ >- else if (gimple_call_return_flags (call) & ERF_RETURNS_ARG) >+ else if (((retflags = gimple_call_return_flags (call)) & >ERF_RETURNS_ARG) >+ && (retflags & ERF_RETURN_ARG_MASK) < gimple_call_num_args (call)) > { > gimple_stmt_iterator iter = gsi_for_stmt (call); >- unsigned int retarg = 0, argno; >- if (gimple_call_return_flags (call) & ERF_RETURNS_ARG) >- retarg = gimple_call_return_flags (call) & ERF_RETURN_ARG_MASK; >+ unsigned int retarg = retflags & ERF_RETURN_ARG_MASK, argno; > if (gimple_call_with_bounds_p (call)) > { > for (argno = 0; argno < gimple_call_num_args (call); argno++) >--- gcc/testsuite/gcc.target/i386/pr65523.c.jj 2015-03-23 >14:44:36.977729292 +0100 >+++ gcc/testsuite/gcc.target/i386/pr65523.c 2015-03-23 >14:45:17.518071777 +0100 >@@ -0,0 +1,11 @@ >+/* PR target/65523 */ >+/* { dg-do compile } */ >+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ >+ >+void *memmove (); >+ >+void * >+bar () >+{ >+ return memmove (); >+} > > Jakub