diff mbox series

Error only when -mabi=ms is used on a non-MS_ABI system (PR sanitizer/90312).

Message ID 7d58226c-a152-c561-66cd-96503b700e8d@suse.cz
State New
Headers show
Series Error only when -mabi=ms is used on a non-MS_ABI system (PR sanitizer/90312). | expand

Commit Message

Martin Liška May 2, 2019, 3:11 p.m. UTC
Hi.

As mentioned in the PR, we should not provide an error on mingw and cygwin
targets.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-05-02  Martin Liska  <mliska@suse.cz>

	PR sanitizer/90312
	* config/i386/i386.c (ix86_option_override_internal): Error only
	when DEFAULT_ABI != MS_ABI.

gcc/testsuite/ChangeLog:

2019-05-02  Martin Liska  <mliska@suse.cz>

	PR sanitizer/90312
	* gcc.dg/asan/pr87930.c: Run the test only on *linux or *gnu
	systems.
	* gcc.dg/tsan/pr88017.c: Likewise.
---
 gcc/config/i386/i386.c              | 11 ++++++++---
 gcc/testsuite/gcc.dg/asan/pr87930.c |  2 +-
 gcc/testsuite/gcc.dg/tsan/pr88017.c |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

Comments

Jakub Jelinek May 2, 2019, 3:19 p.m. UTC | #1
On Thu, May 02, 2019 at 05:11:02PM +0200, Martin Liška wrote:
> As mentioned in the PR, we should not provide an error on mingw and cygwin
> targets.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Can one use sysv_abi in code compiled on windows (where msabi is the
default)?  If yes, don't you get ICE in that case?  As in, shouldn't the
test be that we do not support -fsanitize=address with non-default ABI?

	Jakub
Martin Liška May 3, 2019, 10:51 a.m. UTC | #2
On 5/2/19 5:19 PM, Jakub Jelinek wrote:
> On Thu, May 02, 2019 at 05:11:02PM +0200, Martin Liška wrote:
>> As mentioned in the PR, we should not provide an error on mingw and cygwin
>> targets.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Can one use sysv_abi in code compiled on windows (where msabi is the
> default)?

Who knows, probably not.

> If yes, don't you get ICE in that case?  As in, shouldn't the
> test be that we do not support -fsanitize=address with non-default ABI?

I like the approach.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

> 
> 	Jakub
>
Jakub Jelinek May 6, 2019, 6:31 a.m. UTC | #3
On Fri, May 03, 2019 at 12:51:09PM +0200, Martin Liška wrote:
> 2019-05-02  Martin Liska  <mliska@suse.cz>
> 
> 	PR sanitizer/90312
> 	* config/i386/i386.c (ix86_option_override_internal): Error only
> 	when -mabi is selected to a non-default version.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-05-02  Martin Liska  <mliska@suse.cz>
> 
> 	PR sanitizer/90312
> 	* gcc.dg/asan/pr87930.c: Run the test only on *linux or *gnu
> 	systems.
> 	* gcc.dg/tsan/pr88017.c: Likewise.

Ok, thanks.

	Jakub
diff mbox series

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index bc2348c3bc7..ad6357fab2c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3706,11 +3706,16 @@  ix86_option_override_internal (bool main_args_p,
     error ("%<-mabi=ms%> not supported with X32 ABI");
   gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
 
-  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
+      && opts->x_ix86_abi == MS_ABI
+      && DEFAULT_ABI != MS_ABI)
     error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
-  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+      && opts->x_ix86_abi == MS_ABI
+      && DEFAULT_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)
+  if ((opts->x_flag_sanitize & SANITIZE_THREAD) && opts->x_ix86_abi == MS_ABI
+      && DEFAULT_ABI != MS_ABI)
     error ("%<-mabi=ms%> not supported with %<-fsanitize=thread%>");
 
   /* For targets using ms ABI enable ms-extensions, if not
diff --git a/gcc/testsuite/gcc.dg/asan/pr87930.c b/gcc/testsuite/gcc.dg/asan/pr87930.c
index 4f8e6999fde..5a65d3fb030 100644
--- a/gcc/testsuite/gcc.dg/asan/pr87930.c
+++ b/gcc/testsuite/gcc.dg/asan/pr87930.c
@@ -1,4 +1,4 @@ 
-/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
+/* { dg-do compile { target { { i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } && lp64 } } } */
 /* { dg-options "-fsanitize=address -mabi=ms" } */
 
 int i;
diff --git a/gcc/testsuite/gcc.dg/tsan/pr88017.c b/gcc/testsuite/gcc.dg/tsan/pr88017.c
index 82693a67e87..10df2818b0d 100644
--- a/gcc/testsuite/gcc.dg/tsan/pr88017.c
+++ b/gcc/testsuite/gcc.dg/tsan/pr88017.c
@@ -1,4 +1,4 @@ 
-/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
+/* { dg-do compile { target { { i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } && lp64 } } } */
 /* { dg-options "-fsanitize=thread -mabi=ms" } */
 
 int i;