public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
@ 2011-06-08 20:16 Steve Ellcey
  2011-06-08 20:19 ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2011-06-08 20:16 UTC (permalink / raw)
  To: gcc-patches

Here is a patch to skip gcc.dg/memcpy-3.c on platforms that define
STRICT_ALIGNMENT.  It adds a new check_effective routine,
check_effective_target_strict_align that looks for a warning that will
only be produced on platforms that define STRICT_ALIGNMENT.

Technically, the test may not work if the default alignment for char
variables is the same as __BIGGEST_ALIGNMENT__ but hopefully that is a
rare or non-existent case.  If it does happen we can modify
check_effective_target_strict_align to explicitly check for that
platform.

This new check should be useful for other tests as well but for now
I have just modified gcc.dg/memcpy-3.c to use it.  I verified that
this patch makes gcc.dg/memcpy-3.c UNSUPPORTED on IA64 HP-UX and I will
verify other platforms tonight including X86 Linux where STRICT_ALIGNMENT
is not defined before checking it in.

OK for checkin once my testing is done?

Steve Ellcey
sje@cup.hp.com


2011-06-08  Steve Ellcey  <sje@cup.hp.com>

	PR middle-end/49191
	* lib/target-supports.exp (check_effective_target_strict_align): New.
	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.

Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 174336)
+++ lib/target-supports.exp	(working copy)
@@ -3901,3 +3901,11 @@
     return 1
 }
 
+proc check_effective_target_strict_align {} {
+    return [check_no_compiler_messages strict_align assembly {
+	char *y;
+	typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
+	c *z;
+	void foo(void) { z = (c *) y; }
+    } "-Wcast-align"]
+}
Index: gcc.dg/memcpy-3.c
===================================================================
--- gcc.dg/memcpy-3.c	(revision 174336)
+++ gcc.dg/memcpy-3.c	(working copy)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fdump-tree-optimized" } */
+/* { dg-require-effective-target strict_align } */
 
 int get_int(const void *p)
 {

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

* Re: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
  2011-06-08 20:16 [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT Steve Ellcey
@ 2011-06-08 20:19 ` Jakub Jelinek
  2011-06-08 20:39   ` Steve Ellcey
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2011-06-08 20:19 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: gcc-patches

On Wed, Jun 08, 2011 at 01:03:53PM -0700, Steve Ellcey wrote:
> 2011-06-08  Steve Ellcey  <sje@cup.hp.com>
> 
> 	PR middle-end/49191
> 	* lib/target-supports.exp (check_effective_target_strict_align): New.
> 	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.

Isn't the test backwards, i.e. doesn't
{ dg-require-effective-target strict_align }
actually mean !STRICT_ALIGNMENT?

> Index: lib/target-supports.exp
> ===================================================================
> --- lib/target-supports.exp	(revision 174336)
> +++ lib/target-supports.exp	(working copy)
> @@ -3901,3 +3901,11 @@
>      return 1
>  }
>  
> +proc check_effective_target_strict_align {} {
> +    return [check_no_compiler_messages strict_align assembly {
> +	char *y;
> +	typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
> +	c *z;
> +	void foo(void) { z = (c *) y; }
> +    } "-Wcast-align"]
> +}
> Index: gcc.dg/memcpy-3.c
> ===================================================================
> --- gcc.dg/memcpy-3.c	(revision 174336)
> +++ gcc.dg/memcpy-3.c	(working copy)
> @@ -1,5 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-options "-O -fdump-tree-optimized" } */
> +/* { dg-require-effective-target strict_align } */
>  
>  int get_int(const void *p)
>  {

	Jakub

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

* Re: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
  2011-06-08 20:19 ` Jakub Jelinek
@ 2011-06-08 20:39   ` Steve Ellcey
  2011-06-08 20:45     ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2011-06-08 20:39 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 2011-06-08 at 22:08 +0200, Jakub Jelinek wrote:
> On Wed, Jun 08, 2011 at 01:03:53PM -0700, Steve Ellcey wrote:
> > 2011-06-08  Steve Ellcey  <sje@cup.hp.com>
> > 
> > 	PR middle-end/49191
> > 	* lib/target-supports.exp (check_effective_target_strict_align): New.
> > 	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.
> 
> Isn't the test backwards, i.e. doesn't
> { dg-require-effective-target strict_align }
> actually mean !STRICT_ALIGNMENT?

You are right.  What do you think I should do, reverse the test or just
rename it?  I would be inclined to just rename it, maybe:

dg-require-effective-target non_strict_align

Steve Ellcey
sje@cup.hp.com

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

* Re: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
  2011-06-08 20:39   ` Steve Ellcey
@ 2011-06-08 20:45     ` Jakub Jelinek
  2011-06-08 21:17       ` Steve Ellcey
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2011-06-08 20:45 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: gcc-patches

On Wed, Jun 08, 2011 at 01:16:26PM -0700, Steve Ellcey wrote:
> On Wed, 2011-06-08 at 22:08 +0200, Jakub Jelinek wrote:
> > On Wed, Jun 08, 2011 at 01:03:53PM -0700, Steve Ellcey wrote:
> > > 2011-06-08  Steve Ellcey  <sje@cup.hp.com>
> > > 
> > > 	PR middle-end/49191
> > > 	* lib/target-supports.exp (check_effective_target_strict_align): New.
> > > 	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.
> > 
> > Isn't the test backwards, i.e. doesn't
> > { dg-require-effective-target strict_align }
> > actually mean !STRICT_ALIGNMENT?
> 
> You are right.  What do you think I should do, reverse the test or just
> rename it?  I would be inclined to just rename it, maybe:
> 
> dg-require-effective-target non_strict_align

Yeah, either that, or reverse the test and then
{ dg-do run { target { !strict_align } } } */
(if that is the right syntax).

	Jakub

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

* Re: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
  2011-06-08 20:45     ` Jakub Jelinek
@ 2011-06-08 21:17       ` Steve Ellcey
  2014-06-04  8:23         ` Rainer Orth
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2011-06-08 21:17 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 2011-06-08 at 22:19 +0200, Jakub Jelinek wrote:
> On Wed, Jun 08, 2011 at 01:16:26PM -0700, Steve Ellcey wrote:
> > On Wed, 2011-06-08 at 22:08 +0200, Jakub Jelinek wrote:
> > > On Wed, Jun 08, 2011 at 01:03:53PM -0700, Steve Ellcey wrote:
> > > > 2011-06-08  Steve Ellcey  <sje@cup.hp.com>
> > > > 
> > > > 	PR middle-end/49191
> > > > 	* lib/target-supports.exp (check_effective_target_strict_align): New.
> > > > 	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.
> > > 
> > > Isn't the test backwards, i.e. doesn't
> > > { dg-require-effective-target strict_align }
> > > actually mean !STRICT_ALIGNMENT?
> > 
> > You are right.  What do you think I should do, reverse the test or just
> > rename it?  I would be inclined to just rename it, maybe:
> > 
> > dg-require-effective-target non_strict_align
> 
> Yeah, either that, or reverse the test and then
> { dg-do run { target { !strict_align } } } */
> (if that is the right syntax).
> 
> 	Jakub

Renaming it seems simpler.  If we reverse the test, I can't just return
the result of check_no_compiler_messages, I need to save the result and
reverse the return value.  Then in the actual tests we can't use
dg-require-effective-target but need to modify the dg-do line to do the
check and it will probably always include the '!' to (re-)negate the
check.  It can be done but renaming the test seems a lot simpler.

Steve Ellcey
sje@cup.hp.com

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

* Re: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
  2011-06-08 21:17       ` Steve Ellcey
@ 2014-06-04  8:23         ` Rainer Orth
  0 siblings, 0 replies; 6+ messages in thread
From: Rainer Orth @ 2014-06-04  8:23 UTC (permalink / raw)
  To: sje, Jakub Jelinek; +Cc: gcc-patches

On 06/08/11 22:51, Steve Ellcey wrote:
> On Wed, 2011-06-08 at 22:19 +0200, Jakub Jelinek wrote:
>> On Wed, Jun 08, 2011 at 01:16:26PM -0700, Steve Ellcey wrote:
>>> On Wed, 2011-06-08 at 22:08 +0200, Jakub Jelinek wrote:
>>>> On Wed, Jun 08, 2011 at 01:03:53PM -0700, Steve Ellcey wrote:
>>>>> 2011-06-08  Steve Ellcey  <sje@cup.hp.com>
>>>>>
>>>>> 	PR middle-end/49191
>>>>> 	* lib/target-supports.exp (check_effective_target_strict_align): New.
>>>>> 	* gcc.dg/memcpy-3.c: Add dg-require-effective-target strict_align.
>>>> Isn't the test backwards, i.e. doesn't
>>>> { dg-require-effective-target strict_align }
>>>> actually mean !STRICT_ALIGNMENT?
>>> You are right.  What do you think I should do, reverse the test or just
>>> rename it?  I would be inclined to just rename it, maybe:
>>>
>>> dg-require-effective-target non_strict_align
>> Yeah, either that, or reverse the test and then
>> { dg-do run { target { !strict_align } } } */
>> (if that is the right syntax).
>>
>> 	Jakub
> Renaming it seems simpler.  If we reverse the test, I can't just return
> the result of check_no_compiler_messages, I need to save the result and
> reverse the return value.  Then in the actual tests we can't use
> dg-require-effective-target but need to modify the dg-do line to do the
> check and it will probably always include the '!' to (re-)negate the
> check.  It can be done but renaming the test seems a lot simpler.

I just happened to notice that the (no longer new) non_strict_align 
keyword lacks both a comment in
target-supports.exp and documentation in sourcebuild.texi.

Could you please add both?

Thanks.
   Rainer

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

end of thread, other threads:[~2014-06-04  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 20:16 [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT Steve Ellcey
2011-06-08 20:19 ` Jakub Jelinek
2011-06-08 20:39   ` Steve Ellcey
2011-06-08 20:45     ` Jakub Jelinek
2011-06-08 21:17       ` Steve Ellcey
2014-06-04  8:23         ` Rainer Orth

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).