]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix no_fsanitize_address effective target
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 21 Sep 2021 07:25:47 +0000 (09:25 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 21 Sep 2021 07:32:37 +0000 (09:32 +0200)
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/pr91441.c: Likewise.
* gcc.dg/pr96260.c: Likewise.
* gcc.dg/pr96307.c: Likewise.
* gnat.dg/asan1.adb: Likewise.

* g++.dg/abi/anon4.C: Likewise.

gcc/testsuite/g++.dg/abi/anon4.C
gcc/testsuite/gcc.dg/pr91441.c
gcc/testsuite/gcc.dg/pr96260.c
gcc/testsuite/gcc.dg/pr96307.c
gcc/testsuite/gnat.dg/asan1.adb
gcc/testsuite/lib/target-supports.exp

index 088ba99401936c62b401ff6c91dc1607c3e0a5c8..8200f4bb270f9af7be7064a294a27fac894c8a16 100644 (file)
@@ -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
index 4f7a8fbec5e92e204512153720d294f2d8919a65..4c785f61e597533202f9d3a42ce5a94aa3fd758f 100644 (file)
@@ -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 } */
index 734832f021e321f58b8a73d09539114bef33ee0f..587afb76116c5759751d5d6a2ceb1b4a392bc38a 100644 (file)
@@ -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)
index cd1c17c9661b190a464f0eb0069a80d5625451dd..89002b85c8ea6829e6b78679eedde653bb16753e 100644 (file)
@@ -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};
index a4bc59a9a21431bd7e376cea096bb252a2171af9..26bc1a404475ad7811f607de15d2dfd8f237d2e3 100644 (file)
@@ -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;
 
index 45d34e1a58ef43d2391973e1bb00032e5b99bb59..7c1701f60701a1e7e69ab9ed3b8c7929ce89ecdc 100644 (file)
@@ -11128,14 +11128,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;
 }