From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id B4B933858C3A; Tue, 21 Sep 2021 07:36:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4B933858C3A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10139] Fix no_fsanitize_address effective target X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: d038404096a03cdbb2702c0ea147ab9b1a6134fb X-Git-Newrev: be4faae87a06e8f9165623f1f3eab4ccb89b93a2 Message-Id: <20210921073652.B4B933858C3A@sourceware.org> Date: Tue, 21 Sep 2021 07:36:52 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 07:36:52 -0000 https://gcc.gnu.org/g:be4faae87a06e8f9165623f1f3eab4ccb89b93a2 commit r10-10139-gbe4faae87a06e8f9165623f1f3eab4ccb89b93a2 Author: Eric Botcazou 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. * 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/lib/target-supports.exp | 5 +++-- 5 files changed, 8 insertions(+), 6 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 enum a {test1, test2, test3=INT_MAX}; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 71298eb1b89..2749afe4741 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -10369,13 +10369,14 @@ proc check_effective_target_tune_cortex_a76 { } { return [check_configured_with "with-tune=cortex-a76"] } -# 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; }