From patchwork Sat Mar 7 16:15:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 447615 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 0C976140187 for ; Sun, 8 Mar 2015 03:15:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=j2cpa75O; 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:subject:from:to:date:content-type:mime-version; q= dns; s=default; b=QaecB5SlUx2CGGJ6JgD28D6HA5aIGu3J2LzNdDxcCKq/2m FrigMcP9JHwe6sMgH+7iaPhSSv3Sp+0KjBsje6lzloVSPqwD7apGCorz2Ft6QU6n SqWqKTdKvtGJHwrdVNCEsWKebGXXk+eg3uWIA5XIYp7ijJjMphFZ3yjP7J1xI= 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:subject:from:to:date:content-type:mime-version; s= default; bh=gy55DT9dCfmXR17wQeplOIJpiCA=; b=j2cpa75OOjpYUkdDY0z7 CzYDg+0/8YNxcdDAFkBafdBHLixc0flQxvM4z4b0YbOKyIIgSNG26qb13ugDYQJO 9CyxzZu0c0zuGF9vUYP6yy88DMHZyIY5h+vX6f+vm/3LZCpsC6O0CHDifmCutPXp tuF4ujpgwlAr4axdGPxLa3k= Received: (qmail 18186 invoked by alias); 7 Mar 2015 16:15:19 -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 15979 invoked by uid 89); 7 Mar 2015 16:15:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_05, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout09.t-online.de Received: from mailout09.t-online.de (HELO mailout09.t-online.de) (194.25.134.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 07 Mar 2015 16:15:13 +0000 Received: from fwd41.aul.t-online.de (fwd41.aul.t-online.de [172.20.27.139]) by mailout09.t-online.de (Postfix) with SMTP id 10A3659A91C for ; Sat, 7 Mar 2015 17:15:09 +0100 (CET) Received: from [192.168.0.106] (SOFBmMZAZhwmPwfM9PzYZ72Tc-xLLHJLxWK-OPYcZ971XgLbxDIAuppoMcL9OjNZ8N@[84.183.240.30]) by fwd41.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1YUHNa-3pUktM0; Sat, 7 Mar 2015 17:15:06 +0100 Message-ID: <1425744905.11551.110.camel@yam-132-YW-E178-FTW> Subject: [SH][committed] Add test case for PR 65249 From: Oleg Endo To: gcc-patches Date: Sat, 07 Mar 2015 17:15:05 +0100 Mime-Version: 1.0 X-IsSubscribed: yes Hi, This adds a test case for PR 65249. Tested with make -k check-c++ RUNTESTFLAGS="dg-torture.exp=pr65249.C --target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" Commited as r221256. Cheers, Oleg gcc/testsuite/ChangeLog: PR target/65249 * g++.dg/torture/pr65249.C: New. Index: gcc/testsuite/g++.dg/torture/pr65249.C =================================================================== --- gcc/testsuite/g++.dg/torture/pr65249.C (revision 0) +++ gcc/testsuite/g++.dg/torture/pr65249.C (revision 0) @@ -0,0 +1,54 @@ +// { dg-do compile } +// { dg-additional-options "-fPIC -fstack-protector-strong" { target fpic } } +// { dg-require-effective-target fstack_protector } + +struct struct0 +{ + struct0 (void(*)()); +}; + +int func5 (int* ptr); +void func3 (int*, struct0*); + +inline void +func4 (int* a, void (*b)()) +{ + if (func5 (a) != 2) + { + struct0 f (b); + func3(a, &f); + } +} + +struct struct1 +{ + const void* val0; + const void* val1; +}; + +void* func3 (const void*); + +static const void* gvar1 = 0; +static const void* gvar2 = 0; +static int gvar0 = 0; + +void +func0 (void) +{ + gvar2 = func3 (gvar1); +} + +inline void +func1 (void) +{ + func4 (&gvar0, &func0); +} + +struct1 func2 (void) +{ + func1 (); + struct1 s; + s.val0 = gvar1; + s.val1 = gvar2; + return s; +}