This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 8 Jun 2011 13:03:53 -0700 (PDT)
- Subject: [patch, testsuite] Fix PR 49191 with test for STRICT_ALIGNMENT
- Reply-to: sje at cup dot hp dot com
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)
{