diff mbox series

Disable anchors and msdata for ASAN test-case (PR sanirizer/85174).

Message ID b5410524-b3c7-7831-23b6-cd65488c8afb@suse.cz
State New
Headers show
Series Disable anchors and msdata for ASAN test-case (PR sanirizer/85174). | expand

Commit Message

Martin Liška April 4, 2018, 10:14 a.m. UTC
Hi.

It's test-case workaround, tested on x86_64 and powerpc with both -m64 and -m32.

Ready for trunk?
Thanks,
Martin

gcc/testsuite/ChangeLog:

2018-04-04  Martin Liska  <mliska@suse.cz>

	PR sanirizer/85174
	* c-c++-common/asan/pointer-compare-1.c: Disable section anchors
	and msdata as a workaround for powerpc.
---
 gcc/testsuite/c-c++-common/asan/pointer-compare-1.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jakub Jelinek April 4, 2018, 10:21 a.m. UTC | #1
On Wed, Apr 04, 2018 at 12:14:43PM +0200, Martin Liška wrote:
> Hi.
> 
> It's test-case workaround, tested on x86_64 and powerpc with both -m64 and -m32.
> 
> Ready for trunk?
> Thanks,
> Martin
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-04-04  Martin Liska  <mliska@suse.cz>
> 
> 	PR sanirizer/85174
> 	* c-c++-common/asan/pointer-compare-1.c: Disable section anchors
> 	and msdata as a workaround for powerpc.
> ---
>  gcc/testsuite/c-c++-common/asan/pointer-compare-1.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> 

> diff --git a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> index cf67fe98bee..d4d7784785c 100644
> --- a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> +++ b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> @@ -2,6 +2,9 @@
>  /* { dg-set-target-env-var ASAN_OPTIONS "detect_invalid_pointer_pairs=2:halt_on_error=0" } */
>  /* { dg-options "-fsanitize=address,pointer-compare" } */
>  
> +/* TODO: remove me after PR sanitizer/82501 is resolved.  */
> +/* { dg-additional-options "-fno-section-anchors -msdata=none" { target { powerpc*-*-* } } } */

I'd suggest
/* { dg-additional-options "-fno-section-anchors" } */
and only -msdata=none for powerpc* only.  We have several other section
anchors targets, you can perhaps check gcc-testresults how the test looks
like there.  And use FIXME instead of TODO.

Ok with that change.

	Jakub
Segher Boessenkool April 4, 2018, 10:29 a.m. UTC | #2
On Wed, Apr 04, 2018 at 12:21:14PM +0200, Jakub Jelinek wrote:
> On Wed, Apr 04, 2018 at 12:14:43PM +0200, Martin Liška wrote:
> > It's test-case workaround, tested on x86_64 and powerpc with both -m64 and -m32.
> > 
> > 2018-04-04  Martin Liska  <mliska@suse.cz>
> > 
> > 	PR sanirizer/85174

(typo)

> > 	* c-c++-common/asan/pointer-compare-1.c: Disable section anchors
> > 	and msdata as a workaround for powerpc.
> > ---
> >  gcc/testsuite/c-c++-common/asan/pointer-compare-1.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > 
> 
> > diff --git a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> > index cf67fe98bee..d4d7784785c 100644
> > --- a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> > +++ b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
> > @@ -2,6 +2,9 @@
> >  /* { dg-set-target-env-var ASAN_OPTIONS "detect_invalid_pointer_pairs=2:halt_on_error=0" } */
> >  /* { dg-options "-fsanitize=address,pointer-compare" } */
> >  
> > +/* TODO: remove me after PR sanitizer/82501 is resolved.  */
> > +/* { dg-additional-options "-fno-section-anchors -msdata=none" { target { powerpc*-*-* } } } */
> 
> I'd suggest
> /* { dg-additional-options "-fno-section-anchors" } */
> and only -msdata=none for powerpc* only.  We have several other section
> anchors targets, you can perhaps check gcc-testresults how the test looks
> like there.  And use FIXME instead of TODO.

Another option is to use -G10 or higher, or simply make the little_global
array 8 bytes or less (the default is -G8).  That has the advantage
that we do test sdata and will not have to remember to reenable things
in this testcase.


Segher
Martin Liška April 4, 2018, 10:40 a.m. UTC | #3
On 04/04/2018 12:29 PM, Segher Boessenkool wrote:
> On Wed, Apr 04, 2018 at 12:21:14PM +0200, Jakub Jelinek wrote:
>> On Wed, Apr 04, 2018 at 12:14:43PM +0200, Martin Liška wrote:
>>> It's test-case workaround, tested on x86_64 and powerpc with both -m64 and -m32.
>>>
>>> 2018-04-04  Martin Liska  <mliska@suse.cz>
>>>
>>> 	PR sanirizer/85174
> 
> (typo)

Thanks.

> 
>>> 	* c-c++-common/asan/pointer-compare-1.c: Disable section anchors
>>> 	and msdata as a workaround for powerpc.
>>> ---
>>>  gcc/testsuite/c-c++-common/asan/pointer-compare-1.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>>
>>
>>> diff --git a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
>>> index cf67fe98bee..d4d7784785c 100644
>>> --- a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
>>> +++ b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
>>> @@ -2,6 +2,9 @@
>>>  /* { dg-set-target-env-var ASAN_OPTIONS "detect_invalid_pointer_pairs=2:halt_on_error=0" } */
>>>  /* { dg-options "-fsanitize=address,pointer-compare" } */
>>>  
>>> +/* TODO: remove me after PR sanitizer/82501 is resolved.  */
>>> +/* { dg-additional-options "-fno-section-anchors -msdata=none" { target { powerpc*-*-* } } } */
>>
>> I'd suggest
>> /* { dg-additional-options "-fno-section-anchors" } */
>> and only -msdata=none for powerpc* only.  We have several other section
>> anchors targets, you can perhaps check gcc-testresults how the test looks
>> like there.  And use FIXME instead of TODO.
> 
> Another option is to use -G10 or higher, or simply make the little_global
> array 8 bytes or less (the default is -G8).  That has the advantage
> that we do test sdata and will not have to remember to reenable things
> in this testcase.

Let's do now a quick workaround and fix that properly later.

Martin

> 
> 
> Segher
>
diff mbox series

Patch

diff --git a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
index cf67fe98bee..d4d7784785c 100644
--- a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
+++ b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c
@@ -2,6 +2,9 @@ 
 /* { dg-set-target-env-var ASAN_OPTIONS "detect_invalid_pointer_pairs=2:halt_on_error=0" } */
 /* { dg-options "-fsanitize=address,pointer-compare" } */
 
+/* TODO: remove me after PR sanitizer/82501 is resolved.  */
+/* { dg-additional-options "-fno-section-anchors -msdata=none" { target { powerpc*-*-* } } } */
+
 volatile int v;
 
 __attribute__((noipa)) void