public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954)
@ 2011-03-08  9:44 Mikael Pettersson
  2011-03-08 10:45 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Pettersson @ 2011-03-08  9:44 UTC (permalink / raw)
  To: gcc-patches

gcc.dg/tree-ssa/ssa-ccp-33.c fails with gcc trunk on m68k-linux:

ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
FAIL: gcc.dg/tree-ssa/ssa-ccp-33.c (test for excess errors)
ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'

The test case checks that the compiler is able to eliminate a
runtime check that an aligned pointer-to-int remains aligned after
a loop of increments.  It uses sizeof to compute the alignment
of int, but on m68k (and possibly others) the alignment of int
is less than its size.  The compiler is then unable to eliminate
the broken alignment check, and the call to link_error () is not
removed.

Fixed by using __alignof__ instead.  Regression tested on m68k-linux
where it eliminated the FAIL for gcc.dg/tree-ssa/ssa-ccp-33.c.
Also tested on i686-linux, no changes there.

Ok for trunk?

(Richard G. pre-approved this change on the PR entry, however I
cannot commit it myself.)

gcc/testsuite/

2011-03-08  Mikael Pettersson  <mikpe@it.uu.se>

	PR testsuite/47954
	* gcc.dg/tree-ssa/ssa-ccp-33.c: Use __alignof__ not
	sizeof to compute alignment.

--- gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c.~1~	2010-08-06 13:47:31.000000000 +0200
+++ gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c	2011-03-08 10:34:13.000000000 +0100
@@ -8,7 +8,7 @@ void foo(int n)
   int *p;
   for (p = a; n != 0; --n, ++p)
     ;
-  if ((__SIZE_TYPE__)p & (sizeof (int) - 1))
+  if ((__SIZE_TYPE__)p & (__alignof__ (int) - 1))
     link_error ();
 }
 int main()

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954)
  2011-03-08  9:44 [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954) Mikael Pettersson
@ 2011-03-08 10:45 ` Richard Guenther
  2011-03-08 12:49   ` Mikael Pettersson
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2011-03-08 10:45 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: gcc-patches

On Tue, Mar 8, 2011 at 10:43 AM, Mikael Pettersson <mikpe@it.uu.se> wrote:
> gcc.dg/tree-ssa/ssa-ccp-33.c fails with gcc trunk on m68k-linux:
>
> ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
> ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
> FAIL: gcc.dg/tree-ssa/ssa-ccp-33.c (test for excess errors)
> ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
>
> The test case checks that the compiler is able to eliminate a
> runtime check that an aligned pointer-to-int remains aligned after
> a loop of increments.  It uses sizeof to compute the alignment
> of int, but on m68k (and possibly others) the alignment of int
> is less than its size.  The compiler is then unable to eliminate
> the broken alignment check, and the call to link_error () is not
> removed.
>
> Fixed by using __alignof__ instead.  Regression tested on m68k-linux
> where it eliminated the FAIL for gcc.dg/tree-ssa/ssa-ccp-33.c.
> Also tested on i686-linux, no changes there.
>
> Ok for trunk?
>
> (Richard G. pre-approved this change on the PR entry, however I
> cannot commit it myself.)

Committed.
Richard.

> gcc/testsuite/
>
> 2011-03-08  Mikael Pettersson  <mikpe@it.uu.se>
>
>        PR testsuite/47954
>        * gcc.dg/tree-ssa/ssa-ccp-33.c: Use __alignof__ not
>        sizeof to compute alignment.
>
> --- gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c.~1~     2010-08-06 13:47:31.000000000 +0200
> +++ gcc-4.6-20110305/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-33.c 2011-03-08 10:34:13.000000000 +0100
> @@ -8,7 +8,7 @@ void foo(int n)
>   int *p;
>   for (p = a; n != 0; --n, ++p)
>     ;
> -  if ((__SIZE_TYPE__)p & (sizeof (int) - 1))
> +  if ((__SIZE_TYPE__)p & (__alignof__ (int) - 1))
>     link_error ();
>  }
>  int main()
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954)
  2011-03-08 10:45 ` Richard Guenther
@ 2011-03-08 12:49   ` Mikael Pettersson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Pettersson @ 2011-03-08 12:49 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Mikael Pettersson, gcc-patches

Richard Guenther writes:
 > On Tue, Mar 8, 2011 at 10:43 AM, Mikael Pettersson <mikpe@it.uu.se> wrote:
 > > gcc.dg/tree-ssa/ssa-ccp-33.c fails with gcc trunk on m68k-linux:
 > >
 > > ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
 > > ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
 > > FAIL: gcc.dg/tree-ssa/ssa-ccp-33.c (test for excess errors)
 > > ssa-ccp-33.c:(.text+0x2a): undefined reference to `link_error'
 > >
 > > The test case checks that the compiler is able to eliminate a
 > > runtime check that an aligned pointer-to-int remains aligned after
 > > a loop of increments.  It uses sizeof to compute the alignment
 > > of int, but on m68k (and possibly others) the alignment of int
 > > is less than its size.  The compiler is then unable to eliminate
 > > the broken alignment check, and the call to link_error () is not
 > > removed.
 > >
 > > Fixed by using __alignof__ instead.  Regression tested on m68k-linux
 > > where it eliminated the FAIL for gcc.dg/tree-ssa/ssa-ccp-33.c.
 > > Also tested on i686-linux, no changes there.
 > >
 > > Ok for trunk?
 > >
 > > (Richard G. pre-approved this change on the PR entry, however I
 > > cannot commit it myself.)
 > 
 > Committed.
 > Richard.

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-08 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08  9:44 [PATCH] unbreak gcc.dg/tree-ssa/ssa-ccp-33.c on m68k (PR testsuite/47954) Mikael Pettersson
2011-03-08 10:45 ` Richard Guenther
2011-03-08 12:49   ` Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).