From patchwork Fri Apr 24 14:27:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 464218 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 D962C140150 for ; Sat, 25 Apr 2015 00:27:45 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=MNYs+OMs; dkim-adsp=none (unprotected policy); 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=t8LOS2+ebbz7wNzOd fsbwxuDG1QJtt+pexCMtqgWnfBaUzdln9N8bBWIVv5lbQyICqPnpIL4YepoK4oqt TVjJ2YEV1dNYtOgtXnx6Eh5BaDPywobZqzWJ87phVkANv5oyfjbtp1b4LHvtQIdM JUPZZnMzT3d6eTO2ZFy/Q6wkdM= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=HPKbBMfMnOMGBLKISjbPpkG 84Rg=; b=MNYs+OMsByvO0e0VVvBifVqGqyHt+BzYLwvWzkU+epG4t9Udoo9dbUS gs6LwwvpFgymCYqHA4OemnwYUUEsRAg6Yosl4yhwg9RT1JtuYyqwTLdvKipadKcY 4rw3Q7ubSRegIMzex0hUaWcHmDJWnCYcg4PJogB1hYN2W7FMf1Ig= Received: (qmail 101603 invoked by alias); 24 Apr 2015 14:27:36 -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 101590 invoked by uid 89); 24 Apr 2015 14:27:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Apr 2015 14:27:31 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YleZi-0000YN-OB from Tom_deVries@mentor.com ; Fri, 24 Apr 2015 07:27:27 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 24 Apr 2015 15:27:25 +0100 Message-ID: <553A52CA.9090407@mentor.com> Date: Fri, 24 Apr 2015 16:27:22 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Bin.Cheng CC: Richard Biener , GCC Patches Subject: Re: [PATCH][PR65802] Mark ifn_va_arg with ECF_NOTHROW References: <5535F7EF.1000305@mentor.com> In-Reply-To: On 24-04-15 05:25, Bin.Cheng wrote: > On Tue, Apr 21, 2015 at 3:10 PM, Tom de Vries wrote: >> Hi, >> >> this patch fixes PR65802. >> >> diff --git a/gcc/testsuite/g++.dg/ > pr65802.C b/gcc/testsuite/g++.dg/pr65802.C >> new file mode 100644 >> index 0000000..26e5317 >> --- /dev/null >> +++ b/gcc/testsuite/g++.dg/pr65802.C >> @@ -0,0 +1,29 @@ >> +// { dg-do compile } >> +// { dg-options "-O0" } >> + >> +typedef int tf (); >> + >> +struct S >> +{ >> + tf m_fn1; >> +} a; >> + >> +void >> +fn1 () >> +{ >> + try >> + { >> + __builtin_va_list c; >> + { >> + int *d = __builtin_va_arg (c, int *); >> + int **e = &d; >> + __asm__("" : "=d"(e)); > Hi, thanks for fixing the issue. > But 'd' is a machine specific constraint? This case failed on all arm > processors. Hi, I've rewritten the test-case for C, made the function a valid stdargs function, and removed the superfluous inline assembly. Committed as attached. Thanks, - Tom 2015-04-24 Tom de Vries PR tree-optimization/65802 * g++.dg/pr65802.C: Move to ... * gcc.dg/pr65802.c: ... here. Add -fexceptions to dg-options. Include stdarg.h. Rewrite for C. (fn1): Use va_list and va_arg. Make variable args function. Add use of va_start and va_end. Remove unnecessary inline asm. diff --git a/gcc/testsuite/g++.dg/pr65802.C b/gcc/testsuite/g++.dg/pr65802.C deleted file mode 100644 index 26e5317..0000000 --- a/gcc/testsuite/g++.dg/pr65802.C +++ /dev/null @@ -1,29 +0,0 @@ -// { dg-do compile } -// { dg-options "-O0" } - -typedef int tf (); - -struct S -{ - tf m_fn1; -} a; - -void -fn1 () -{ - try - { - __builtin_va_list c; - { - int *d = __builtin_va_arg (c, int *); - int **e = &d; - __asm__("" : "=d"(e)); - a.m_fn1 (); - } - a.m_fn1 (); - } - catch (...) - { - - } -} diff --git a/gcc/testsuite/gcc.dg/pr65802.c b/gcc/testsuite/gcc.dg/pr65802.c new file mode 100644 index 0000000..fcec234 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65802.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fexceptions" } */ + +#include + +struct S +{ + int (*m_fn1) (void); +} a; + +void +fn1 (int d, ...) +{ + va_list c; + va_start (c, d); + + { + int *d = va_arg (c, int *); + + int **e = &d; + + a.m_fn1 (); + } + + a.m_fn1 (); + + va_end (c); +} -- 1.9.1