public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9019] Fix no_fsanitize_address effective target Date: Tue, 21 Sep 2021 07:33:12 +0000 (GMT) [thread overview] Message-ID: <20210921073312.C1145385841F@sourceware.org> (raw) https://gcc.gnu.org/g:d891ef6ac495b6150a2d799d29b1f864ccd92235 commit r11-9019-gd891ef6ac495b6150a2d799d29b1f864ccd92235 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Tue Sep 21 09:25:47 2021 +0200 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/pr91441.c: Likewise. * gcc.dg/pr96260.c: Likewise. * gcc.dg/pr96307.c: Likewise. * gnat.dg/asan1.adb: Likewise. * g++.dg/abi/anon4.C: Likewise. Diff: --- gcc/testsuite/g++.dg/abi/anon4.C | 1 + gcc/testsuite/gcc.dg/pr91441.c | 4 ++-- gcc/testsuite/gcc.dg/pr96260.c | 2 +- gcc/testsuite/gcc.dg/pr96307.c | 2 +- gcc/testsuite/gnat.dg/asan1.adb | 2 +- gcc/testsuite/lib/target-supports.exp | 5 +++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/g++.dg/abi/anon4.C b/gcc/testsuite/g++.dg/abi/anon4.C index 088ba994019..8200f4bb270 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/gcc.dg/pr91441.c b/gcc/testsuite/gcc.dg/pr91441.c index 4f7a8fbec5e..4c785f61e59 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 734832f021e..587afb76116 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 cd1c17c9661..89002b85c8e 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/gnat.dg/asan1.adb b/gcc/testsuite/gnat.dg/asan1.adb index a4bc59a9a21..26bc1a40447 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 45d34e1a58e..7c1701f6070 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -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; }
reply other threads:[~2021-09-21 7:33 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210921073312.C1145385841F@sourceware.org \ --to=ebotcazou@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).