Hi. It's very similar to what I did few days ago for -fsanitize=address and -mabi=ms.
Patch survives tests on x86_64-linux-gnu and bootstraps. Ready for trunk? Thanks, Martin gcc/ChangeLog: 2018-11-20 Martin Liska <mli...@suse.cz> PR sanitizer/88017 * config/i386/i386.c (ix86_option_override_internal): gcc/testsuite/ChangeLog: 2018-11-20 Martin Liska <mli...@suse.cz> PR sanitizer/88017 * gcc.dg/tsan/pr88017.c: New test. --- gcc/config/i386/i386.c | 2 ++ gcc/testsuite/gcc.dg/tsan/pr88017.c | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tsan/pr88017.c
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c18c60a1d19..6bd1eeefe87 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3550,6 +3550,8 @@ ix86_option_override_internal (bool main_args_p, error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>"); if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI) error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>"); + if ((opts->x_flag_sanitize & SANITIZE_THREAD) && opts->x_ix86_abi == MS_ABI) + error ("%<-mabi=ms%> not supported with %<-fsanitize=thread%>"); /* For targets using ms ABI enable ms-extensions, if not explicit turned off. For non-ms ABI we turn off this diff --git a/gcc/testsuite/gcc.dg/tsan/pr88017.c b/gcc/testsuite/gcc.dg/tsan/pr88017.c new file mode 100644 index 00000000000..82693a67e87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr88017.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-fsanitize=thread -mabi=ms" } */ + +int i; + +/* { dg-error ".-mabi=ms. not supported with .-fsanitize=thread." "" { target *-*-* } 0 } */