From patchwork Thu Dec 3 10:54:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 552130 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 D518014029E for ; Thu, 3 Dec 2015 21:55:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=N9sDkypa; dkim-atps=neutral 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=TIewwHY0GLnRkHqV58HEiRpNUZKJT35WL2KHE6b7kiOHyaYBIG/an Ppp1Sd65zfHYd2qjsSbRyLZJ3lgA0PMCnVDoEQB9+ZF0sKF2XBztPlyLLq2D4o5R gp4M3MIrpbiFWXVkPHtiZghlTQW0clZ7/BB664evuolr2181U0XDHI= 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:subject:message-id:mime-version:content-type; s= default; bh=xA+LQNfg+l/+tX3TaNdWSr0K7mA=; b=N9sDkypa2a9GAlKMTo2x bNPOtzA13FU8KF3Td8W6rxNqY1AAs1UW6VEwuvcLoFz/5jv2FopHTMhkKrb2K2Lp 9wbK4HPVTqX+ZJC/Lngfdm17rJ1fkjA3j2V8LG9rCo/iMhRJZ4iYJcntiIEgcEXq SFeXbYGxZW0vkJOycczwei8= Received: (qmail 36132 invoked by alias); 3 Dec 2015 10:55:10 -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 36117 invoked by uid 89); 3 Dec 2015 10:55:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f172.google.com Received: from mail-io0-f172.google.com (HELO mail-io0-f172.google.com) (209.85.223.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 03 Dec 2015 10:55:08 +0000 Received: by ioc74 with SMTP id 74so76571649ioc.2 for ; Thu, 03 Dec 2015 02:55:06 -0800 (PST) X-Received: by 10.107.185.133 with SMTP id j127mr8773202iof.91.1449140106341; Thu, 03 Dec 2015 02:55:06 -0800 (PST) Received: from msticlxl57.ims.intel.com (irdmzpr01-ext.ir.intel.com. [192.198.151.36]) by smtp.gmail.com with ESMTPSA id eb1sm2728723igc.17.2015.12.03.02.55.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Dec 2015 02:55:06 -0800 (PST) Date: Thu, 3 Dec 2015 13:54:30 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, CHKP] Fix bounds returned for structures Message-ID: <20151203105430.GA41884@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, Currently multiple return-struct-* tests from MPX testsuite fail. This patch fixes it. Bootstrapped and tested on x86_64-unknown-linux-gnu. Applied to trunk. I'm going to port it to GCC5 after 5.3 release. Thanks, Ilya --- gcc/ 2015-12-03 Ilya Enkovich * cfgexpand.c (expand_gimple_stmt_1): Return statement with DECL as return value is allowed to have NULL bounds. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 1990e10..2c3b23d 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -3534,6 +3534,12 @@ expand_gimple_stmt_1 (gimple *stmt) { tree result = DECL_RESULT (current_function_decl); + /* Mark we have return statement with missing bounds. */ + if (!bnd + && chkp_function_instrumented_p (cfun->decl) + && !DECL_P (op0)) + bnd = error_mark_node; + /* If we are not returning the current function's RESULT_DECL, build an assignment to it. */ if (op0 != result) @@ -3550,9 +3556,6 @@ expand_gimple_stmt_1 (gimple *stmt) op0 = build2 (MODIFY_EXPR, TREE_TYPE (result), result, op0); } - /* Mark we have return statement with missing bounds. */ - if (!bnd && chkp_function_instrumented_p (cfun->decl)) - bnd = error_mark_node; } if (!op0)