diff mbox series

Fix split-path-5.c testcase (PR testsuite/88454)

Message ID 20181213074953.GR12380@tucnak
State New
Headers show
Series Fix split-path-5.c testcase (PR testsuite/88454) | expand

Commit Message

Jakub Jelinek Dec. 13, 2018, 7:49 a.m. UTC
Hi!

On Mon, Dec 10, 2018 at 09:56:46PM -0700, Jeff Law wrote:
> Note that split-path-5 has the same basic structure.  A half-diamond
> with a single statement in the middle block that should be trivially
> if-convertable if profitable.  So I adjusted that testcase.

The split-path-5.c testcase now fails on powerpc64*, arm*, aarch64* etc.
targets.

When looking for the difference, I found out it is a -fsigned-char vs.
-funsigned-char issue, on -funsigned-char targets we are simply compiling
something quite different.

The following patch fixes it, regtested on x86_64-linux (-m64/-m32) and
tested with cross to aarch64-linux and powerpc64-linux.  Ok for trunk?

2018-12-13  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/88454
	* gcc.dg/tree-ssa/split-path-5.c (__ctype_ptr__): Change type from
	const char * to const signed char *.
	(bmhi_init): Change pattern parameter's type the same.  Use
	__builtin_strlen instead of undeclared strlen.



	Jakub

Comments

Segher Boessenkool Dec. 13, 2018, 12:37 p.m. UTC | #1
On Thu, Dec 13, 2018 at 08:49:53AM +0100, Jakub Jelinek wrote:
> On Mon, Dec 10, 2018 at 09:56:46PM -0700, Jeff Law wrote:
> > Note that split-path-5 has the same basic structure.  A half-diamond
> > with a single statement in the middle block that should be trivially
> > if-convertable if profitable.  So I adjusted that testcase.
> 
> The split-path-5.c testcase now fails on powerpc64*, arm*, aarch64* etc.
> targets.
> 
> When looking for the difference, I found out it is a -fsigned-char vs.
> -funsigned-char issue, on -funsigned-char targets we are simply compiling
> something quite different.

Ha :-)

> The following patch fixes it, regtested on x86_64-linux (-m64/-m32) and
> tested with cross to aarch64-linux and powerpc64-linux.  Ok for trunk?

This is an obvious patch, isn't it :-)


Segher


> 2018-12-13  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR testsuite/88454
> 	* gcc.dg/tree-ssa/split-path-5.c (__ctype_ptr__): Change type from
> 	const char * to const signed char *.
> 	(bmhi_init): Change pattern parameter's type the same.  Use
> 	__builtin_strlen instead of undeclared strlen.
> 
> --- gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c.jj	2018-12-11 11:02:09.003065907 +0100
> +++ gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c	2018-12-13 08:36:26.457533278 +0100
> @@ -1,16 +1,16 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details -w" } */
>  
> -const extern char *__ctype_ptr__;
> +const extern signed char *__ctype_ptr__;
>  typedef unsigned char uchar;
>  static int patlen;
>  static int skip[(0x7f * 2 + 1) + 1];
>  static uchar *pat = ((void *) 0);
>  void
> -bmhi_init (const char *pattern)
> +bmhi_init (const signed char *pattern)
>  {
>    int i, lastpatchar;
> -  patlen = strlen (pattern);
> +  patlen = __builtin_strlen (pattern);
>    for (i = 0; i < patlen; i++)
>      pat[i] = (
>  	       {
Jeff Law Dec. 13, 2018, 6:46 p.m. UTC | #2
On 12/13/18 12:49 AM, Jakub Jelinek wrote:
> Hi!
> 
> On Mon, Dec 10, 2018 at 09:56:46PM -0700, Jeff Law wrote:
>> Note that split-path-5 has the same basic structure.  A half-diamond
>> with a single statement in the middle block that should be trivially
>> if-convertable if profitable.  So I adjusted that testcase.
> 
> The split-path-5.c testcase now fails on powerpc64*, arm*, aarch64* etc.
> targets.
> 
> When looking for the difference, I found out it is a -fsigned-char vs.
> -funsigned-char issue, on -funsigned-char targets we are simply compiling
> something quite different.
> 
> The following patch fixes it, regtested on x86_64-linux (-m64/-m32) and
> tested with cross to aarch64-linux and powerpc64-linux.  Ok for trunk?
> 
> 2018-12-13  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR testsuite/88454
> 	* gcc.dg/tree-ssa/split-path-5.c (__ctype_ptr__): Change type from
> 	const char * to const signed char *.
> 	(bmhi_init): Change pattern parameter's type the same.  Use
> 	__builtin_strlen instead of undeclared strlen.
Yea.  Interesting that we hadn't had problems with it before.  THanks
for taking care of it while I was out.

jeff
diff mbox series

Patch

--- gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c.jj	2018-12-11 11:02:09.003065907 +0100
+++ gcc/testsuite/gcc.dg/tree-ssa/split-path-5.c	2018-12-13 08:36:26.457533278 +0100
@@ -1,16 +1,16 @@ 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fsplit-paths -fdump-tree-split-paths-details -w" } */
 
-const extern char *__ctype_ptr__;
+const extern signed char *__ctype_ptr__;
 typedef unsigned char uchar;
 static int patlen;
 static int skip[(0x7f * 2 + 1) + 1];
 static uchar *pat = ((void *) 0);
 void
-bmhi_init (const char *pattern)
+bmhi_init (const signed char *pattern)
 {
   int i, lastpatchar;
-  patlen = strlen (pattern);
+  patlen = __builtin_strlen (pattern);
   for (i = 0; i < patlen; i++)
     pat[i] = (
 	       {