Fix a test-case for Darwin.

Message ID 567f634e-98b5-a880-0541-381e7b8d38a7@suse.cz
State New
Headers show
Series
  • Fix a test-case for Darwin.
Related show

Commit Message

Martin Liška Oct. 11, 2017, 6:15 a.m.
Hello.

This should address failing test-case on Darwin.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

gcc/testsuite/ChangeLog:

2017-10-10  Martin Liska  <mliska@suse.cz>

	* c-c++-common/ubsan/ptr-overflow-sanitization-1.c: Scan
	optimized dump rather than assembly.
---
 gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jakub Jelinek Oct. 11, 2017, 7:13 a.m. | #1
On Wed, Oct 11, 2017 at 08:15:16AM +0200, Martin Liška wrote:
> Hello.
> 
> This should address failing test-case on Darwin.

Guess this should fix it not just on Darwin, but also on any target
where the assembler doesn't have a call instruction but something different
(e.g. bl and many others).

> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> gcc/testsuite/ChangeLog:
> 
> 2017-10-10  Martin Liska  <mliska@suse.cz>
> 
> 	* c-c++-common/ubsan/ptr-overflow-sanitization-1.c: Scan
> 	optimized dump rather than assembly.

Ok, thanks.  With a nit:

> diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
> index 42c14523764..b966d52a61d 100644
> --- a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
> +++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
> @@ -1,5 +1,5 @@
>  /* { dg-require-effective-target lp64 } */

Do you really need the above line?  I thought now that the test
is using __PTRDIFF_MAX__ you shouldn't really need that...

> -/* { dg-options "-O -fsanitize=pointer-overflow" } */
> +/* { dg-options "-O -fsanitize=pointer-overflow -fdump-tree-optimized" } */
>  /* { dg-skip-if "" { *-*-* } "-flto" } */
>  
>  #define SMAX   __PTRDIFF_MAX__
> @@ -76,5 +76,4 @@ void negative_to_negative (char *ptr)
>    p2 += 5;
>  }
>  
> -
> -/* { dg-final { scan-assembler-times "call\\s+__ubsan_handle_pointer_overflow" 17 } } */
> +/* { dg-final { scan-tree-dump-times "__ubsan_handle_pointer_overflow" 17 "optimized" } } */
> 


	Jakub
Martin Liška Oct. 11, 2017, 12:23 p.m. | #2
On 10/11/2017 09:13 AM, Jakub Jelinek wrote:
> On Wed, Oct 11, 2017 at 08:15:16AM +0200, Martin Liška wrote:
>> Hello.
>>
>> This should address failing test-case on Darwin.
> 
> Guess this should fix it not just on Darwin, but also on any target
> where the assembler doesn't have a call instruction but something different
> (e.g. bl and many others).

Yes, I can see it on ppc64le.

> 
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-10-10  Martin Liska  <mliska@suse.cz>
>>
>> 	* c-c++-common/ubsan/ptr-overflow-sanitization-1.c: Scan
>> 	optimized dump rather than assembly.
> 
> Ok, thanks.  With a nit:
> 
>> diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
>> index 42c14523764..b966d52a61d 100644
>> --- a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
>> +++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
>> @@ -1,5 +1,5 @@
>>  /* { dg-require-effective-target lp64 } */
> 
> Do you really need the above line?  I thought now that the test
> is using __PTRDIFF_MAX__ you shouldn't really need that...

Done that and installed.

Thanks,
Martin

> 
>> -/* { dg-options "-O -fsanitize=pointer-overflow" } */
>> +/* { dg-options "-O -fsanitize=pointer-overflow -fdump-tree-optimized" } */
>>  /* { dg-skip-if "" { *-*-* } "-flto" } */
>>  
>>  #define SMAX   __PTRDIFF_MAX__
>> @@ -76,5 +76,4 @@ void negative_to_negative (char *ptr)
>>    p2 += 5;
>>  }
>>  
>> -
>> -/* { dg-final { scan-assembler-times "call\\s+__ubsan_handle_pointer_overflow" 17 } } */
>> +/* { dg-final { scan-tree-dump-times "__ubsan_handle_pointer_overflow" 17 "optimized" } } */
>>
> 
> 
> 	Jakub
>

Patch

diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
index 42c14523764..b966d52a61d 100644
--- a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
+++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-sanitization-1.c
@@ -1,5 +1,5 @@ 
 /* { dg-require-effective-target lp64 } */
-/* { dg-options "-O -fsanitize=pointer-overflow" } */
+/* { dg-options "-O -fsanitize=pointer-overflow -fdump-tree-optimized" } */
 /* { dg-skip-if "" { *-*-* } "-flto" } */
 
 #define SMAX   __PTRDIFF_MAX__
@@ -76,5 +76,4 @@  void negative_to_negative (char *ptr)
   p2 += 5;
 }
 
-
-/* { dg-final { scan-assembler-times "call\\s+__ubsan_handle_pointer_overflow" 17 } } */
+/* { dg-final { scan-tree-dump-times "__ubsan_handle_pointer_overflow" 17 "optimized" } } */