diff mbox series

Test for sigsetjmp support in analyzer tests requiring that feature.

Message ID e76d42a1-3f9c-be3c-2779-57a9b4558915@codesourcery.com
State New
Headers show
Series Test for sigsetjmp support in analyzer tests requiring that feature. | expand

Commit Message

Sandra Loosemore March 22, 2020, 5:31 p.m. UTC
The new-ish analyzer test cases sigsetjmp-5.c and sigsetjmp-6.c were 
failing on nios2-elf and probably other newlib targets due to lack of 
support for sigsetjmp.  I didn't see a suitable existing 
effective-target test for this, so I added one.

OK to commit?

-Sandra

Comments

Jeff Law via Gcc-patches March 22, 2020, 6:13 p.m. UTC | #1
On Sun, 2020-03-22 at 11:31 -0600, Sandra Loosemore wrote:
> The new-ish analyzer test cases sigsetjmp-5.c and sigsetjmp-6.c were 
> failing on nios2-elf and probably other newlib targets due to lack
> of 
> support for sigsetjmp.

Sorry about the breakage.

> I didn't see a suitable existing 
> effective-target test for this, so I added one.

Thanks.

> OK to commit?

Looks good to me.

Dave
Thomas Schwinge April 2, 2020, 9:36 a.m. UTC | #2
Hi!

On 2020-03-22T11:31:31-0600, Sandra Loosemore <sandra@codesourcery.com> wrote:
> The new-ish analyzer test cases sigsetjmp-5.c and sigsetjmp-6.c were
> failing on nios2-elf and probably other newlib targets due to lack of
> support for sigsetjmp.  I didn't see a suitable existing
> effective-target test for this, so I added one.

> --- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
> @@ -1,3 +1,5 @@
> +/* { dg-require-effective-target sigsetjmp } */

> --- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
> +++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
> @@ -1,3 +1,5 @@
> +/* { dg-require-effective-target sigsetjmp } */

> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp

> +# Returns 1 if "sigsetjmp" is available on the target system.
> +
> +proc check_effective_target_sigsetjmp {} {
> +    return [check_function_available "sigsetjmp"]
> +}

That got pushed to master branch as commit
adaf4b6c66e789d927684003b9ee05ed04c105ea "Test for sigsetjmp support in
analyzer tests requiring that feature".

On x86_64-pc-linux-gnu I now see these tests regress to:

    UNSUPPORTED: gcc.dg/analyzer/sigsetjmp-5.c
    UNSUPPORTED: gcc.dg/analyzer/sigsetjmp-6.c

..., because of:

    Executing on host: [xgcc] sigsetjmp_available6728.c [...] -fno-builtin  -lm    -o sigsetjmp_available6728.exe    (timeout = 300)
    spawn [xgcc] sigsetjmp_available6728.c [...] -fno-builtin -lm -o sigsetjmp_available6728.exe
    /tmp/ccKsf87z.o: In function `main':
    sigsetjmp_available6728.c:(.text+0xa): undefined reference to `sigsetjmp'
    collect2: error: ld returned 1 exit status
    [...]

Does that maybe have something to do with feature test macros required
for 'sigsetjmp'?


Grüße
 Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Tobias Burnus April 2, 2020, 10:09 a.m. UTC | #3
Interestingly, only those two testcases use the effective-target check:
gcc.dg/analyzer/sigsetjmp-5.c, gcc.dg/analyzer/sigsetjmp-6.c

Regarding the link test: No header file is included – it just
defines the function ("extern char $funcname();") and calls it.
The check fails as "sigsetjmp" does not exist in glibc –
the symbol is "__sigsetjmp" in glibc.

If one includes '#include <setjmp.h>', it works – even without
explicitly setting _POSIX_C_SOURCE.

BTW: sigsetjmp is also used by the following testcase, but without the
effective-target check:
g++.dg/asan/asan_test.cc, g++.dg/torture/pr57190.C, gcc.dg/pr69167.c,
gcc.dg/torture/float128-exact-underflow.c,
gcc.dg/torture/float128-extendxf-underflow.c,
gcc.dg/torture/pr57147-3.c, gcc.dg/torture/pr81900.c,
gcc.dg/ubsan/pr94423.c, gcc.target/sh/torture/pr30807.c

Cheers,

Tobias

On 4/2/20 11:36 AM, Thomas Schwinge wrote:

> Hi!
>
> On 2020-03-22T11:31:31-0600, Sandra Loosemore <sandra@codesourcery.com> wrote:
>> The new-ish analyzer test cases sigsetjmp-5.c and sigsetjmp-6.c were
>> failing on nios2-elf and probably other newlib targets due to lack of
>> support for sigsetjmp.  I didn't see a suitable existing
>> effective-target test for this, so I added one.
>> --- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
>> +++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
>> @@ -1,3 +1,5 @@
>> +/* { dg-require-effective-target sigsetjmp } */
>> --- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
>> +++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
>> @@ -1,3 +1,5 @@
>> +/* { dg-require-effective-target sigsetjmp } */
>> --- a/gcc/testsuite/lib/target-supports.exp
>> +++ b/gcc/testsuite/lib/target-supports.exp
>> +# Returns 1 if "sigsetjmp" is available on the target system.
>> +
>> +proc check_effective_target_sigsetjmp {} {
>> +    return [check_function_available "sigsetjmp"]
>> +}
> That got pushed to master branch as commit
> adaf4b6c66e789d927684003b9ee05ed04c105ea "Test for sigsetjmp support in
> analyzer tests requiring that feature".
>
> On x86_64-pc-linux-gnu I now see these tests regress to:
>
>      UNSUPPORTED: gcc.dg/analyzer/sigsetjmp-5.c
>      UNSUPPORTED: gcc.dg/analyzer/sigsetjmp-6.c
>
> ..., because of:
>
>      Executing on host: [xgcc] sigsetjmp_available6728.c [...] -fno-builtin  -lm    -o sigsetjmp_available6728.exe    (timeout = 300)
>      spawn [xgcc] sigsetjmp_available6728.c [...] -fno-builtin -lm -o sigsetjmp_available6728.exe
>      /tmp/ccKsf87z.o: In function `main':
>      sigsetjmp_available6728.c:(.text+0xa): undefined reference to `sigsetjmp'
>      collect2: error: ld returned 1 exit status
>      [...]
>
> Does that maybe have something to do with feature test macros required
> for 'sigsetjmp'?
>
>
> Grüße
>   Thomas
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Sandra Loosemore April 2, 2020, 8:45 p.m. UTC | #4
On 4/2/20 4:09 AM, Tobias Burnus wrote:
> Interestingly, only those two testcases use the effective-target check:
> gcc.dg/analyzer/sigsetjmp-5.c, gcc.dg/analyzer/sigsetjmp-6.c
> 
> Regarding the link test: No header file is included – it just
> defines the function ("extern char $funcname();") and calls it.

This is the same way configure scripts test for the existence of a 
library function; the test case is just an arbitrary reference to the 
named function that will generate an undefined symbol error from the 
linker if the standard libraries don't provide a definition.

> The check fails as "sigsetjmp" does not exist in glibc –
> the symbol is "__sigsetjmp" in glibc.

I've checked in this followup patch to make it also test for the 
presence of __sigsetjmp, and verified that the test case now runs and 
passes on x86_64_linux-gnu.

-Sandra
diff mbox series

Patch

commit 86645c71b1ee8ca228a72a0c21ae38c4264da8fb
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Sun Mar 22 10:22:59 2020 -0700

    Test for sigsetjmp support in analyzer tests requiring that feature.
    
    2020-03-22  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gcc/testsuite/
    	* gcc.dg/analyzer/sigsetjmp-5.c: Require sigsetjmp support.
    	* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
    	* lib/target-supports.exp (check_effective_target_sigsetjmp): New.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 892fcb6..32fc629 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@ 
+2020-03-22  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* gcc.dg/analyzer/sigsetjmp-5.c: Require sigsetjmp support.
+	* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
+	* lib/target-supports.exp (check_effective_target_sigsetjmp): New.
+
 2020-03-22  Iain Buclaw  <ibuclaw@gdcproject.org>
 
 	PR d/93038
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
index 68afe9d..2bc73e8 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target sigsetjmp } */
+
 #include <setjmp.h>
 #include <stddef.h>
 #include "analyzer-decls.h"
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
index fcd9d0b..d45804b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
@@ -1,3 +1,5 @@ 
+/* { dg-require-effective-target sigsetjmp } */
+
 #include <setjmp.h>
 #include <stddef.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 4413c26..6456126 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8984,6 +8984,12 @@  proc check_effective_target_stpcpy {} {
     return [check_function_available "stpcpy"]
 }
 
+# Returns 1 if "sigsetjmp" is available on the target system.
+
+proc check_effective_target_sigsetjmp {} {
+    return [check_function_available "sigsetjmp"]
+}
+
 # Check whether the vectorizer tests are supported by the target and
 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
 # If a port wants to execute the tests more than once it should append