From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] sanitizer: Fix hwasan related option conflicts [PR106132]
Date: Wed, 29 Jun 2022 14:04:45 +0200 [thread overview]
Message-ID: <c4e7448c-2245-ea59-f491-b66d97241cb0@suse.cz> (raw)
Split report_conflicting_sanitizer_options(..., SANITIZE_ADDRESS | SANITIZE_HWADDRESS)
call into 2 calls as we don't have any option that would be
address+hwaddress (that conflicts as well).
PR sanitizer/106132
gcc/ChangeLog:
* opts.cc (finish_options): Use 2 calls to
report_conflicting_sanitizer_options.
gcc/testsuite/ChangeLog:
* c-c++-common/hwasan/arguments-3.c: Cover new ICE.
---
gcc/opts.cc | 4 +++-
gcc/testsuite/c-c++-common/hwasan/arguments-3.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gcc/opts.cc b/gcc/opts.cc
index fe0293e4283..54e57f36755 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -1214,7 +1214,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
/* Address sanitizers conflict with the thread sanitizer. */
report_conflicting_sanitizer_options (opts, loc, SANITIZE_THREAD,
- SANITIZE_ADDRESS | SANITIZE_HWADDRESS);
+ SANITIZE_ADDRESS);
+ report_conflicting_sanitizer_options (opts, loc, SANITIZE_THREAD,
+ SANITIZE_HWADDRESS);
/* The leak sanitizer conflicts with the thread sanitizer. */
report_conflicting_sanitizer_options (opts, loc, SANITIZE_LEAK,
SANITIZE_THREAD);
diff --git a/gcc/testsuite/c-c++-common/hwasan/arguments-3.c b/gcc/testsuite/c-c++-common/hwasan/arguments-3.c
index 6e907b46b3b..2bf8917355b 100644
--- a/gcc/testsuite/c-c++-common/hwasan/arguments-3.c
+++ b/gcc/testsuite/c-c++-common/hwasan/arguments-3.c
@@ -1,3 +1,5 @@
/* { dg-do compile } */
-/* { dg-additional-options "-fsanitize=thread" } */
+/* { dg-additional-options "-fsanitize=thread,address" } */
+/* { dg-error ".*'-fsanitize=thread' is incompatible with '-fsanitize=address'.*" "" { target *-*-* } 0 } */
/* { dg-error ".*'-fsanitize=thread' is incompatible with '-fsanitize=hwaddress'.*" "" { target *-*-* } 0 } */
+/* { dg-error ".*'-fsanitize=hwaddress' is incompatible with '-fsanitize=address'.*" "" { target *-*-* } 0 } */
--
2.36.1
next reply other threads:[~2022-06-29 12:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 12:04 Martin Liška [this message]
2022-07-01 19:34 ` Jeff Law
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=c4e7448c-2245-ea59-f491-b66d97241cb0@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@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: link
Be 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).