From patchwork Thu May 21 08:38:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 474887 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 701FF14075F for ; Thu, 21 May 2015 18:38:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=apreX6I6; 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=cWH5ORjxmiBH8TRqH2tlXt7QoZq5bcp+SkcAc9dH7ooR7OvY2VQOP 3DmCdOIO+dHRf6u7kxDkuY6qV/KYXaiLMrE0pbqwQ+ts2vfaZcjxFUaNMEbpHyLo bKlUtseHO/Q7IeZJkWmY7WntRhk/WutVBjN9pCyhsVwo0oKpcgao54= 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=7ZsG7tvr4zpkHei0D7sGxJRVgGo=; b=apreX6I6nrt7Psq0TjGP OuTTyS8uXU+P7YbKUoyhbh/xBs01AHrO0HsTn0oGqVsBZtwNGW3wtdE4iA8NnEzF d994MLcq703+cj3J4z++h+jYi74MyO+C7w0UpLCEusUwTgvtBKjs9xT3N4tVWkt2 wInjc4pr6AVm9RDJD9fpI+I= Received: (qmail 64674 invoked by alias); 21 May 2015 08:38:17 -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 64665 invoked by uid 89); 21 May 2015 08:38:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f175.google.com Received: from mail-ig0-f175.google.com (HELO mail-ig0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 21 May 2015 08:38:16 +0000 Received: by igbpi8 with SMTP id pi8so4175019igb.1 for ; Thu, 21 May 2015 01:38:14 -0700 (PDT) X-Received: by 10.107.168.87 with SMTP id r84mr1879920ioe.47.1432197493953; Thu, 21 May 2015 01:38:13 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.54.42]) by mx.google.com with ESMTPSA id kl1sm672773igb.15.2015.05.21.01.38.12 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 01:38:13 -0700 (PDT) Date: Thu, 21 May 2015 11:38:06 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, CHKP] Fix PR middle-end/66221: lto1: error: type variant has different TYPE_ARG_TYPES Message-ID: <20150521083806.GG47912@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, This patch fixes PR66221 by using build_distinct_type_copy instead of copy_node to copy a function type for instrumented function. Bootstrapped and regtested for x86_64-unknown-linux-gnu. Applied to trunk. Is it OK for gcc-5? Thanks, Ilya --- gcc/ 2015-05-21 Ilya Enkovich PR middle-end/66221 * ipa-chkp.c (chkp_copy_function_type_adding_bounds): Use build_distinct_type_copy to copy bounds. gcc/testsuite/ 2015-05-21 Ilya Enkovich PR middle-end/66221 * gcc.dg/lto/pr66221_0.c: New test. * gcc.dg/lto/pr66221_1.c: New test. diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index ac5eb35..c710291 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -308,7 +308,7 @@ chkp_copy_function_type_adding_bounds (tree orig_type) if (!arg_type) return orig_type; - type = copy_node (orig_type); + type = build_distinct_type_copy (orig_type); TYPE_ARG_TYPES (type) = copy_list (TYPE_ARG_TYPES (type)); for (arg_type = TYPE_ARG_TYPES (type); diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_0.c b/gcc/testsuite/gcc.dg/lto/pr66221_0.c new file mode 100644 index 0000000..dbb9282 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr66221_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx } } } */ + +int test1 (const char *); + +int main (int argc, const char **argv) +{ + return test1 (argv[0]); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr66221_1.c b/gcc/testsuite/gcc.dg/lto/pr66221_1.c new file mode 100644 index 0000000..4c94544 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr66221_1.c @@ -0,0 +1,4 @@ +int test1 (const char *p) +{ + return (int)(*p); +}