From patchwork Mon Jul 3 15:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 106903 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp5858072qge; Mon, 3 Jul 2017 08:01:06 -0700 (PDT) X-Received: by 10.84.229.136 with SMTP id c8mr11256536plk.27.1499094066352; Mon, 03 Jul 2017 08:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499094066; cv=none; d=google.com; s=arc-20160816; b=iv24Zcc1qZ+3BaPc7p2WMK3gO8yt3e8eTCEFZNVjZKN0BDpHNnd7qOaKo7cGpMbYsb coNBKn8ly9G/4/c047VmIOIGWlTN7sLGbtFfL+yP51bhvzTUhKqEhqtTAfWObkYwfaDL QJneCQbZIRhbJ3gqk+qVwdUCUkkbZsWtfroo10+OjiD50VGf6K5HnxqU1CML99+lXYRu pV80PbbL+ObiGGBIGzXha8+iVtyOavVrJYCdSWM66DIGCJDUfTW1dllJ03G/gVPCdrTX xeybSMkRVzN6pYy6gWqSqLtE+VoM5kXrTRKD6l9SnVtYOKStZft6TcN37cC2d38deRVr Ry6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:delivered-to:sender :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=5Yek/Ulp+fXVcTVdC3Lrdd07VWmSIwloD5/CbY6wM3Y=; b=csr3qstwOGZMI/aRvdGCtQ1XkcskQ+48foc3BPAURGpNi9LnQFSI4b6zW+mTZwGrry IvxP5JMsBjNaSiD+pPwKE6+bPgW8qFhHtQup6xlCyHm38ER9VG0CK84Rf6FOjOD0kC2G mYLJVXZKbbA7Hlef0rXv39Bm88Fd/k9NYbFc5A8HsjRKMGrQua9sFLkjiA1F9K7fosBT DiGX8hxOgslftCmDvJDsleOnRU3y+wys5Lnmvho8OtT/QTiKtvZAFJmFTnoGemp+pW0R Xb9iHHjfJK7QkTcTMFcnGyLzWpJKgbAI4fmu5dAfMPQk3r82A5RgmbpZo4SlhUG8xk27 A5xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=I7/Umb0K; spf=pass (google.com: domain of gcc-patches-return-457461-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-457461-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e65si12277349pgc.26.2017.07.03.08.01.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2017 08:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-457461-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=I7/Umb0K; spf=pass (google.com: domain of gcc-patches-return-457461-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-457461-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=JwZAfLCB3Bpb8ChYszMzCzcIeO28S4G74OBA8K4q3fT3D0 XG4UR8i5v3YrV9/P05TAJBfuoEpryYRVFnpA6+lcrtOfYKK4LlLOusTsgmtQMLBB LqLkW7G6AyKeqIjkktZdiSxbmXZ7tF3sherROy/x3fYjwfF9vU4AlPG4GyYyk= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=+P1uHlKF2tQMOljVxv/FOjD7B94=; b=I7/Umb0Kr3Jk5MYXTpIP EAl3gbqsUgqDMej7AuD2nY/SyaU+B9CB9z2bHmkMR0Rn+MfNAeBattMpYIPlVXQN 742plirT03XDee8kXLjRc/8zux3U7gzXWIyuVdcYbp44Y0YpVMrraSlto4GVb2pf G23UcNm7DkuLE2wtnIcMiU8= Received: (qmail 51856 invoked by alias); 3 Jul 2017 15:00:44 -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 49889 invoked by uid 89); 3 Jul 2017 15:00:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:check_s, merely, Reduced, 10636 X-HELO: mail-ua0-f173.google.com Received: from mail-ua0-f173.google.com (HELO mail-ua0-f173.google.com) (209.85.217.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Jul 2017 15:00:18 +0000 Received: by mail-ua0-f173.google.com with SMTP id z22so111065393uah.1 for ; Mon, 03 Jul 2017 08:00:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=B2DkRNGBIq/I8o/nQYTadEzdV1P/3sIs2365yBXJBtQ=; b=YaUGDXlnq2ukDWrf+2pp1VtqhGEUGBmn58U7RX1Mxd19Uq4cIBVtFoAbeMYm4AU2ca 0H6kQJ09jw7PzdxbNTlkbXakCK5iW1vdqNW9mSFWon56o0J9/fle1OstD7Odaz9PmELM DO0H1gaBAYbNw9y/BXX4FxXgpbWz1Ev5URGj0/X2fxh4Z6/zaRWA61fy37yBZc157w6K 99qGALlP5wpCFVW17bDs66KoO2qJX0OgNywBXkVBijmrqfYTqxBxVvjBOHDv9UbeO4N+ eG+F/hd3UVETXxlZweEfnsWPSUNdpUgB1eGHv/8ilsbChEm954S0upBO/O2m7eYaYZz9 YAcg== X-Gm-Message-State: AKS2vOxE4dtXE4BYERWOooHbd23COirKv+laJcbq8+pbyih1bnlahR1I 41gt5JDLM3DxjjYa5AoAYs6W9uuuR96upGjqvQ== X-Received: by 10.176.67.163 with SMTP id l32mr18473559ual.119.1499094005102; Mon, 03 Jul 2017 08:00:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.148.220 with HTTP; Mon, 3 Jul 2017 08:00:04 -0700 (PDT) From: Christophe Lyon Date: Mon, 3 Jul 2017 17:00:04 +0200 Message-ID: Subject: [PATCH][testsuite] Add dg-require-stack-check To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes Hi, This is a follow-up to https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01791.html This patch adds dg-require-stack-check and updates the tests that use dg-options "-fstack-check" to avoid failures on configurations that to not support it. I merely copied what we currently do to check if visibility flags are supported, and cross-tested on aarch64 and arm targets with the results I expected. This means that my testing does not cover the changes I propose for i386 and gnat. Is it OK nonetheless? Thanks, Christophe 2017-07-03 Christophe Lyon * lib/target-supports-dg.exp (dg-require-stack-check): New. * lib/target-supports.exp (check_stack_check_available): New. * g++.dg/other/i386-9.C: Add dg-require-stack-check. * gcc.c-torture/compile/stack-check-1.c: Likewise. * gcc.dg/graphite/run-id-pr47653.c: Likewise. * gcc.dg/pr47443.c: Likewise. * gcc.dg/pr48134.c: Likewise. * gcc.dg/pr70017.c: Likewise. * gcc.target/aarch64/stack-checking.c: Likewise. * gcc.target/arm/stack-checking.c: Likewise. * gcc.target/i386/pr48723.c: Likewise. * gcc.target/i386/pr55672.c: Likewise. * gcc.target/i386/pr67265-2.c: Likewise. * gcc.target/i386/pr67265.c: Likewise. * gnat.dg/opt49.adb: Likewise. * gnat.dg/stack_check1.adb: Likewise. * gnat.dg/stack_check2.adb: Likewise. * gnat.dg/stack_check3.adb: Likewise. diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index 6400d64..d50d8b0 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -265,6 +265,21 @@ proc dg-require-linker-plugin { args } { } } +# If this target does not support the "stack-check" option, skip this +# test. + +proc dg-require-stack-check { args } { + set stack_check_available [ check_stack_check_available [lindex $args 1 ] ] + if { $stack_check_available == -1 } { + upvar name name + unresolved "$name" + } + if { $stack_check_available != 1 } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + # Add any target-specific flags needed for accessing the given list # of features. This must come after all dg-options. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index fe5e777..d19892e 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1063,6 +1063,17 @@ proc check_effective_target_fstack_protector {} { } "-fstack-protector"] } +# Return 1 if the target supports -fstack-check or -fstack-check=$stack_kind +proc check_stack_check_available { stack_kind } { + if [string match "" $stack_kind] then { + set stack_opt "-fstack-check" + } else { set stack_opt "-fstack-check=$stack_kind" } + + return [check_no_compiler_messages stack_check executable { + int main (void) { return 0; } + } "$stack_opt"] +} + # Return 1 if compilation with -freorder-blocks-and-partition is error-free # for trivial code, 0 otherwise. As some targets (ARM for example) only # warn when -fprofile-use is also supplied we test that combination too. diff --git a/gcc/testsuite/g++.dg/other/i386-9.C b/gcc/testsuite/g++.dg/other/i386-9.C index 7964057..782cf87 100644 --- a/gcc/testsuite/g++.dg/other/i386-9.C +++ b/gcc/testsuite/g++.dg/other/i386-9.C @@ -2,6 +2,7 @@ // Testcase by Zdenek Sojka // { dg-do run { target i?86-*-* x86_64-*-* } } +/* { dg-require-stack-check "" } */ // { dg-options "-Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer" } int main() diff --git a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c index 5c99688..2a03f7c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c @@ -1,3 +1,4 @@ /* { dg-require-effective-target untyped_assembly } */ +/* { dg-require-stack-check "" } */ /* { dg-additional-options "-fstack-check" } */ #include "20031023-1.c" diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c b/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c index cd9d8eb..ca91af4 100644 --- a/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c +++ b/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c @@ -1,3 +1,4 @@ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic -ftree-pre -fgraphite-identity" } */ /* nvptx doesn't expose a stack. */ /* { dg-skip-if "" { nvptx-*-* } } */ diff --git a/gcc/testsuite/gcc.dg/pr47443.c b/gcc/testsuite/gcc.dg/pr47443.c index 47abea2..5a5c43f 100644 --- a/gcc/testsuite/gcc.dg/pr47443.c +++ b/gcc/testsuite/gcc.dg/pr47443.c @@ -1,5 +1,6 @@ /* PR tree-optimization/47443 */ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic" } */ static inline int bar (char *c, int i) diff --git a/gcc/testsuite/gcc.dg/pr48134.c b/gcc/testsuite/gcc.dg/pr48134.c index 8dc5a6d..446ad01 100644 --- a/gcc/testsuite/gcc.dg/pr48134.c +++ b/gcc/testsuite/gcc.dg/pr48134.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "specific" } */ /* { dg-options "-O2 -fstack-check=specific -fno-tree-dse -fno-tree-fre -fno-tree-loop-optimize -g" } */ struct S diff --git a/gcc/testsuite/gcc.dg/pr70017.c b/gcc/testsuite/gcc.dg/pr70017.c index f544167..3489d5b 100644 --- a/gcc/testsuite/gcc.dg/pr70017.c +++ b/gcc/testsuite/gcc.dg/pr70017.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-fstack-check=generic" } */ /* Check that the expected warning is issued for large frames. */ diff --git a/gcc/testsuite/gcc.target/aarch64/stack-checking.c b/gcc/testsuite/gcc.target/aarch64/stack-checking.c index 1d1530d..eaa4058 100644 --- a/gcc/testsuite/gcc.target/aarch64/stack-checking.c +++ b/gcc/testsuite/gcc.target/aarch64/stack-checking.c @@ -1,4 +1,5 @@ /* { dg-do run { target { *-*-linux* } } } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check" } */ int main(void) diff --git a/gcc/testsuite/gcc.target/arm/stack-checking.c b/gcc/testsuite/gcc.target/arm/stack-checking.c index 88a7e6e..4b53bed 100644 --- a/gcc/testsuite/gcc.target/arm/stack-checking.c +++ b/gcc/testsuite/gcc.target/arm/stack-checking.c @@ -1,6 +1,6 @@ /* { dg-do run { target { *-*-linux* } } } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check" } */ -/* { dg-skip-if "" { arm_thumb1 } } */ int main(void) { diff --git a/gcc/testsuite/gcc.target/i386/pr48723.c b/gcc/testsuite/gcc.target/i386/pr48723.c index ad10209..222c075 100644 --- a/gcc/testsuite/gcc.target/i386/pr48723.c +++ b/gcc/testsuite/gcc.target/i386/pr48723.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check -mavx" } */ struct S0 diff --git a/gcc/testsuite/gcc.target/i386/pr55672.c b/gcc/testsuite/gcc.target/i386/pr55672.c index 6f1c898..f7b0d71 100644 --- a/gcc/testsuite/gcc.target/i386/pr55672.c +++ b/gcc/testsuite/gcc.target/i386/pr55672.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic" } */ int main () diff --git a/gcc/testsuite/gcc.target/i386/pr67265-2.c b/gcc/testsuite/gcc.target/i386/pr67265-2.c index a9f2eb4..690a784 100644 --- a/gcc/testsuite/gcc.target/i386/pr67265-2.c +++ b/gcc/testsuite/gcc.target/i386/pr67265-2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-O -fstack-check" } */ void foo (int n) diff --git a/gcc/testsuite/gcc.target/i386/pr67265.c b/gcc/testsuite/gcc.target/i386/pr67265.c index 7827685..2671acc 100644 --- a/gcc/testsuite/gcc.target/i386/pr67265.c +++ b/gcc/testsuite/gcc.target/i386/pr67265.c @@ -2,6 +2,7 @@ /* Reduced testcase by Johannes Dewender */ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-O -fstack-check -fPIC" } */ int a, b, c, d, e; diff --git a/gcc/testsuite/gnat.dg/opt49.adb b/gcc/testsuite/gnat.dg/opt49.adb index 4b91973..42ab953 100644 --- a/gcc/testsuite/gnat.dg/opt49.adb +++ b/gcc/testsuite/gnat.dg/opt49.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-O -fstack-check" } procedure Opt49 is diff --git a/gcc/testsuite/gnat.dg/stack_check1.adb b/gcc/testsuite/gnat.dg/stack_check1.adb index 51ee1a6..eaad745 100644 --- a/gcc/testsuite/gnat.dg/stack_check1.adb +++ b/gcc/testsuite/gnat.dg/stack_check1.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-fstack-check" } -- This test requires architecture- and OS-specific support code for unwinding diff --git a/gcc/testsuite/gnat.dg/stack_check2.adb b/gcc/testsuite/gnat.dg/stack_check2.adb index 4a3008b..f34d647 100644 --- a/gcc/testsuite/gnat.dg/stack_check2.adb +++ b/gcc/testsuite/gnat.dg/stack_check2.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-fstack-check" } -- This test requires architecture- and OS-specific support code for unwinding diff --git a/gcc/testsuite/gnat.dg/stack_check3.adb b/gcc/testsuite/gnat.dg/stack_check3.adb index 734ed42..3bb859c 100644 --- a/gcc/testsuite/gnat.dg/stack_check3.adb +++ b/gcc/testsuite/gnat.dg/stack_check3.adb @@ -1,4 +1,5 @@ -- { dg-do compile } +-- { dg-require-stack-check "" } -- { dg-options "-O -fstack-check" } package body Stack_Check3 is