Message ID | CAKdteOYe2Na_5NPrgc8+5Yr-n1j=F+wPqpRNUsm7ei+jpdy6FQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 4 July 2017 at 10:50, Christophe Lyon <christophe.lyon@linaro.org> wrote: > On 3 July 2017 at 17:30, Jeff Law <law@redhat.com> wrote: >> On 07/03/2017 09:00 AM, Christophe Lyon wrote: >>> 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 >>> >>> >>> stack-check-et.chlog.txt >>> >>> >>> 2017-07-03 Christophe Lyon <christophe.lyon@linaro.org> >>> >>> * 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. >> ACK once you address Rainer's comments. I've got further stack-check >> tests in the queue which I'll update once your change goes in. >> >> jeff > > Here is an updated version, which adds documentation for dg-require-stack-check. > > I also ran make-check on and x86_64 with ada enabled and checked the logs: > the updated i386/* and gnat.dg* tests all pass, and are preceded by > the compilation > of the "stack_check" sample. > > OK? Jeff, let me know if/when you want me to commit this? Thanks, Christophe > > Thanks, > > Christophe
On 07/04/2017 02:50 AM, Christophe Lyon wrote: > On 3 July 2017 at 17:30, Jeff Law <law@redhat.com> wrote: >> On 07/03/2017 09:00 AM, Christophe Lyon wrote: >>> 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 >>> >>> >>> stack-check-et.chlog.txt >>> >>> >>> 2017-07-03 Christophe Lyon <christophe.lyon@linaro.org> >>> >>> * 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. >> ACK once you address Rainer's comments. I've got further stack-check >> tests in the queue which I'll update once your change goes in. >> >> jeff > Here is an updated version, which adds documentation for dg-require-stack-check. > > I also ran make-check on and x86_64 with ada enabled and checked the logs: > the updated i386/* and gnat.dg* tests all pass, and are preceded by > the compilation > of the "stack_check" sample. > > OK? > > Thanks, > > Christophe > > > stack-check-et.chlog.txt > > > 2017-07-04 Christophe Lyon <christophe.lyon@linaro.org> > > gcc/ > * doc/sourcebuild.texi (Test Directives, Variants of > dg-require-support): Add documentation for dg-require-stack-check. > > gcc/testsuite/ > * 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. OK for the trunk. Thanks for doing this! Jeff
Hi, On 6 July 2017 at 06:50, Jeff Law <law@redhat.com> wrote: > On 07/04/2017 02:50 AM, Christophe Lyon wrote: >> On 3 July 2017 at 17:30, Jeff Law <law@redhat.com> wrote: >>> On 07/03/2017 09:00 AM, Christophe Lyon wrote: >>>> 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 >>>> >>>> >>>> stack-check-et.chlog.txt >>>> >>>> >>>> 2017-07-03 Christophe Lyon <christophe.lyon@linaro.org> >>>> >>>> * 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. >>> ACK once you address Rainer's comments. I've got further stack-check >>> tests in the queue which I'll update once your change goes in. >>> >>> jeff >> Here is an updated version, which adds documentation for dg-require-stack-check. >> >> I also ran make-check on and x86_64 with ada enabled and checked the logs: >> the updated i386/* and gnat.dg* tests all pass, and are preceded by >> the compilation >> of the "stack_check" sample. >> >> OK? >> >> Thanks, >> >> Christophe >> >> >> stack-check-et.chlog.txt >> >> >> 2017-07-04 Christophe Lyon <christophe.lyon@linaro.org> >> >> gcc/ >> * doc/sourcebuild.texi (Test Directives, Variants of >> dg-require-support): Add documentation for dg-require-stack-check. >> >> gcc/testsuite/ >> * 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. > OK for the trunk. Thanks for doing this! > I've committed this as r250013. Since then, I've noticed that pr48134 randomly fails. According to gcc.log, this seems related the order wrt pr47443. pr48134 uses -fstack-check=specific, while pr47443 uses -fstack-check=generic. When pr47443 appears before pr48134 in gcc.log, the latter fails, otherwise it is unsupported. Looking at gcc.log, it seems that dg-require-stack-check is not always called. Is there some caching in dejagnu I'm not aware of, that would ignore the value of the parameter (assuming that dg-require-stack-check "specific" and dg-require-stack-check "generic" return the same value?) Am I missing anything obvious? Thanks, Christophe > Jeff
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 4136a68..85af877 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2311,6 +2311,11 @@ the codeset to convert to. Skip the test if the target does not support profiling with option @var{profopt}. +@item dg-require-stack-check @var{check} +Skip the test if the target does not support the @code{-fstack-check} +option. If @var{check} is @code{""}, support for @code{-fstack-check} +is checked, for @code{-fstack-check=("@var{check}")} otherwise. + @item dg-require-visibility @var{vis} Skip the test if the target does not support the @code{visibility} attribute. If @var{vis} is @code{""}, support for @code{visibility("hidden")} is 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 <zsojka@seznam.cz> // { 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 <gnu@JonnyJD.net> */ /* { 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