[patch RFC] Tweak gcc.c-torture/execute/nest-align-1.c

Kaz Kojima kkojima@rr.iij4u.or.jp
Sat Feb 23 00:59:00 GMT 2008


Hi,

gcc.c-torture/execute/nest-align-1.c which is recently added
fails on SH.  From testresults posting, it fails also on ARM
  http://gcc.gnu.org/ml/gcc-testresults/2008-02/msg01396.html
and MIPS
  http://gcc.gnu.org/ml/gcc-testresults/2008-02/msg01409.html
at least.

The testcase defines a 16-byte aligned type and uses an automatic
variable with that type.  The test checks if the alignment of
this variable on stack matches with __alignof__ of that type.
It seems that this fails on targets with PREFERRED_STACK_BOUNDARY
less than 128, because the real alignment of that variable is
limited to PREFERRED_STACK_BOUNDARY.
Since our doc/extend.texi says

 Whenever you leave out the alignment factor in an @code{aligned} attribute
 specification, the compiler automatically sets the alignment for the declared
 variable or field to the largest alignment which is ever used for any data
 type on the target machine you are compiling for. 

how about the patch below?
It's tested on i686-pc-linux-gnu with "make -k check".

Regards,
	kaz
--
2008-02-22  Kaz Kojima  <kkojima@gcc.gnu.org>

	* gcc.c-torture/execute/nest-align-1.c: Use the largest alignment.

diff -uprN ORIG/trunk/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c LOCAL/trunk/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c
--- ORIG/trunk/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c	2008-02-20 08:52:02.000000000 +0900
+++ LOCAL/trunk/gcc/testsuite/gcc.c-torture/execute/nest-align-1.c	2008-02-22 22:33:07.000000000 +0900
@@ -4,7 +4,7 @@
 
 #include <stddef.h>
 
-typedef int aligned __attribute__((aligned(16)));
+typedef int aligned __attribute__((aligned));
 extern void abort (void);
 
 void



More information about the Gcc-patches mailing list