diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2021-09-21 09:25:47 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2021-09-21 09:29:39 +0200 |
commit | 6e6bf4cd21af39a7923bae007517ab43a4c3b36a (patch) | |
tree | 56e59e96253a468ac4913893724b51ebf5a7db85 /gcc | |
parent | 417ea5c02cef7f000e66d1af22b066c2c1cda047 (diff) | |
download | gcc-6e6bf4cd21af39a7923bae007517ab43a4c3b36a.zip gcc-6e6bf4cd21af39a7923bae007517ab43a4c3b36a.tar.gz gcc-6e6bf4cd21af39a7923bae007517ab43a4c3b36a.tar.bz2 |
Fix no_fsanitize_address effective target
The implementation of the no_fsanitize_address effective target was copied
from asan-dg.exp without realizing that it does not work outside of this
context (there is a comment explaining why). As a consequence, it always
returns 0, so for example the directive in gnat.dg/asan1.adb:
{ dg-skip-if "no address sanitizer" { no_fsanitize_address } }
does not work. This led some people to add the nonsensical:
{ dg-require-effective-target no_fsanitize_address }
to sanitizer tests, e.g. g++.dg/warn/uninit-pr93100.C, thus disabling them
everywhere instead of just for the problematic targets.
gcc/testsuite/
* lib/target-supports.exp (no_fsanitize_address): Add missing bits.
* gcc.dg/uninit-pr93100.c: Skip if no_fsanitize_address.
* gcc.dg/pr91441.c: Likewise.
* gcc.dg/pr96260.c: Likewise.
* gcc.dg/pr96307.c: Likewise.
* g++.dg/warn/uninit-pr93100.C: Likewise.
* gnat.dg/asan1.adb: Likewise.
* gcc.dg/Wstringop-overflow-70.c: Adjust for SPARC.
* g++.dg/abi/anon4.C: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/abi/anon4.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/uninit-pr93100.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wstringop-overflow-70.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr91441.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr96260.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr96307.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/uninit-pr93100.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/asan1.adb | 2 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 5 |
9 files changed, 14 insertions, 12 deletions
diff --git a/gcc/testsuite/g++.dg/abi/anon4.C b/gcc/testsuite/g++.dg/abi/anon4.C index 088ba99..8200f4b 100644 --- a/gcc/testsuite/g++.dg/abi/anon4.C +++ b/gcc/testsuite/g++.dg/abi/anon4.C @@ -1,4 +1,5 @@ // PR c++/65209 +// { dg-additional-options "-fno-pie" { target sparc*-*-* } } // { dg-final { scan-assembler-not "comdat" } } // Everything involving the anonymous namespace bits should be private, not diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C index 56dc894..e08a36d 100644 --- a/gcc/testsuite/g++.dg/warn/uninit-pr93100.C +++ b/gcc/testsuite/g++.dg/warn/uninit-pr93100.C @@ -1,7 +1,7 @@ /* PR tree-optimization/98508 - Sanitizer disable -Wall and -Wextra { dg-do compile } - { dg-require-effective-target no_fsanitize_address } - { dg-options "-O0 -Wall -fsanitize=address" } */ + { dg-options "-O0 -Wall -fsanitize=address" } + { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ struct S { diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c index 82c4d9f..ccfe2ce 100644 --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-70.c @@ -17,8 +17,8 @@ void* warn_loop (void) char *p = __builtin_malloc (15); for (int i = 0; i != 16; ++i) /* The size of the write below depends on the target. When vectorized - the vector size may be 4 or 16, otherwise it may be a series of byte + the vector size may be 4, 8 or 16, otherwise it may be a series of byte assignments. */ - p[i] = i; // { dg-warning "writing (1|2|4|16) bytes? into a region of size (0|1|3|15)" } + p[i] = i; // { dg-warning "writing (1|2|4|8|16) bytes? into a region of size (0|1|3|7|15)" } return p; } diff --git a/gcc/testsuite/gcc.dg/pr91441.c b/gcc/testsuite/gcc.dg/pr91441.c index 4f7a8fb..4c785f6 100644 --- a/gcc/testsuite/gcc.dg/pr91441.c +++ b/gcc/testsuite/gcc.dg/pr91441.c @@ -1,11 +1,11 @@ /* PR target/91441 */ /* { dg-do compile } */ -/* { dg-require-effective-target no_fsanitize_address }*/ /* { dg-options "--param asan-stack=1 -fsanitize=kernel-address" } */ +/* { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ int *bar(int *); int *f( int a) { return bar(&a); } -/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not supported without '-fasan-shadow-offset=' for this target" "" { target *-*-* } 0 } */ +/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not supported without '-fasan-shadow-offset=' for this target" "" { target riscv*-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr96260.c b/gcc/testsuite/gcc.dg/pr96260.c index 734832f..587afb7 100644 --- a/gcc/testsuite/gcc.dg/pr96260.c +++ b/gcc/testsuite/gcc.dg/pr96260.c @@ -1,7 +1,7 @@ /* PR target/96260 */ /* { dg-do compile } */ -/* { dg-require-effective-target no_fsanitize_address }*/ /* { dg-options "--param asan-stack=1 -fsanitize=kernel-address -fasan-shadow-offset=0x100000" } */ +/* { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ int *bar(int *); int *f( int a) diff --git a/gcc/testsuite/gcc.dg/pr96307.c b/gcc/testsuite/gcc.dg/pr96307.c index cd1c17c..89002b8 100644 --- a/gcc/testsuite/gcc.dg/pr96307.c +++ b/gcc/testsuite/gcc.dg/pr96307.c @@ -1,7 +1,7 @@ /* PR target/96307 */ /* { dg-do compile } */ -/* { dg-require-effective-target no_fsanitize_address }*/ /* { dg-additional-options "-fsanitize=kernel-address --param=asan-instrumentation-with-call-threshold=8" } */ +/* { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ #include <limits.h> enum a {test1, test2, test3=INT_MAX}; diff --git a/gcc/testsuite/gcc.dg/uninit-pr93100.c b/gcc/testsuite/gcc.dg/uninit-pr93100.c index 531a5c3..7cb0222 100644 --- a/gcc/testsuite/gcc.dg/uninit-pr93100.c +++ b/gcc/testsuite/gcc.dg/uninit-pr93100.c @@ -1,7 +1,7 @@ /* PR tree-optimization/93100 - gcc -fsanitize=address inhibits -Wuninitialized { dg-do compile } { dg-options "-Wall -fsanitize=address" } - { dg-skip-if "sanitize address" { "powerpc-ibm-aix*" } } */ + { dg-skip-if "no address sanitizer" { no_fsanitize_address } } */ struct A { diff --git a/gcc/testsuite/gnat.dg/asan1.adb b/gcc/testsuite/gnat.dg/asan1.adb index a4bc59a..26bc1a4 100644 --- a/gcc/testsuite/gnat.dg/asan1.adb +++ b/gcc/testsuite/gnat.dg/asan1.adb @@ -1,7 +1,7 @@ -- { dg-do compile } -- { dg-additional-sources asan1_pkg.ads } -- { dg-options "-fsanitize=address" } --- { dg-skip-if "" no_fsanitize_address } +-- { dg-skip-if "no address sanitizer" { no_fsanitize_address } } with Asan1_Pkg; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f11c4e6..9ebca7a 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11251,14 +11251,15 @@ proc check_effective_target_movdir { } { } "-mmovdiri -mmovdir64b" ] } -# Return 1 if target is not support address sanitize, 1 otherwise. +# Return 1 if the target does not support address sanitizer, 0 otherwise proc check_effective_target_no_fsanitize_address {} { if ![check_no_compiler_messages fsanitize_address executable { int main (void) { return 0; } - }] { + } "-fsanitize=address" ] { return 1; } + return 0; } |