public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature.
@ 2020-03-22 17:31 Sandra Loosemore
  2020-03-22 18:13 ` David Malcolm
  2020-04-02  9:36 ` Thomas Schwinge
  0 siblings, 2 replies; 5+ messages in thread
From: Sandra Loosemore @ 2020-03-22 17:31 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

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

[-- Attachment #2: sigsetjmp.patch --]
[-- Type: text/x-patch, Size: 2401 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature.
  2020-03-22 17:31 [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature Sandra Loosemore
@ 2020-03-22 18:13 ` David Malcolm
  2020-04-02  9:36 ` Thomas Schwinge
  1 sibling, 0 replies; 5+ messages in thread
From: David Malcolm @ 2020-03-22 18:13 UTC (permalink / raw)
  To: Sandra Loosemore, gcc-patches

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature.
  2020-03-22 17:31 [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature Sandra Loosemore
  2020-03-22 18:13 ` David Malcolm
@ 2020-04-02  9:36 ` Thomas Schwinge
  2020-04-02 10:09   ` Tobias Burnus
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Schwinge @ 2020-04-02  9:36 UTC (permalink / raw)
  To: Sandra Loosemore, gcc-patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature.
  2020-04-02  9:36 ` Thomas Schwinge
@ 2020-04-02 10:09   ` Tobias Burnus
  2020-04-02 20:45     ` Sandra Loosemore
  0 siblings, 1 reply; 5+ messages in thread
From: Tobias Burnus @ 2020-04-02 10:09 UTC (permalink / raw)
  To: Thomas Schwinge, Sandra Loosemore, gcc-patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature.
  2020-04-02 10:09   ` Tobias Burnus
@ 2020-04-02 20:45     ` Sandra Loosemore
  0 siblings, 0 replies; 5+ messages in thread
From: Sandra Loosemore @ 2020-04-02 20:45 UTC (permalink / raw)
  To: Tobias Burnus, Thomas Schwinge, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

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

[-- Attachment #2: sigsetjmp-2.patch --]
[-- Type: text/x-patch, Size: 1538 bytes --]

commit a950bb6e95236bb60ec17cda36763945d3d0a714
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Thu Apr 2 13:37:58 2020 -0700

    Fix check_effective_target_sigsetjmp for glibc targets.
    
    2020-04-02  Sandra Loosemore  <sandra@codesourcery.com>
    
    	gcc/testsuite/
    	* lib/target-supports.exp (check_effective_target_sigsetjmp): Test
    	for __sigsetjmp as well as sigsetjmp.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 050cecd..cd8d7e1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-02  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* lib/target-supports.exp (check_effective_target_sigsetjmp): Test
+	for __sigsetjmp as well as sigsetjmp.
+
 2020-04-02  Fritz Reese  <foreese@gcc.gnu.org>
 
 	PR fortran/85982
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 3654e7b..0dfe3ae 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9036,9 +9036,15 @@ proc check_effective_target_stpcpy {} {
 }
 
 # Returns 1 if "sigsetjmp" is available on the target system.
+# Also check if "__sigsetjmp" is defined since that's what glibc
+# uses.
 
 proc check_effective_target_sigsetjmp {} {
-    return [check_function_available "sigsetjmp"]
+    if { [check_function_available "sigsetjmp"]
+         || [check_function_available "__sigsetjmp"] } {
+	return 1
+    }
+    return 0
 }
 
 # Check whether the vectorizer tests are supported by the target and

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-02 20:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 17:31 [PATCH] Test for sigsetjmp support in analyzer tests requiring that feature Sandra Loosemore
2020-03-22 18:13 ` David Malcolm
2020-04-02  9:36 ` Thomas Schwinge
2020-04-02 10:09   ` Tobias Burnus
2020-04-02 20:45     ` Sandra Loosemore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).