Description: Allow #pragma align to be used after a variable is declared GCC mandates that #pragma align precede any declaration, Sun C does not. See http://wiki.illumos.org/display/illumos/GCC+Modifications Index: gcc-5/src/gcc/config/sol2-c.c =================================================================== --- gcc-5.orig/src/gcc/config/sol2-c.c +++ gcc-5/src/gcc/config/sol2-c.c @@ -125,8 +125,9 @@ solaris_pragma_align (cpp_reader *pfile { tree decl = identifier_global_value (t); if (decl && DECL_P (decl)) - warning (0, "%<#pragma align%> must appear before the declaration of " - "%D, ignoring", decl); + decl_attributes (&decl, build_tree_list (get_identifier ("aligned"), + build_tree_list (NULL, x)), + 0); else solaris_pending_aligns = tree_cons (t, build_tree_list (NULL, x), solaris_pending_aligns); Index: gcc-5/src/gcc/testsuite/gcc.dg/pragma-align-2.c =================================================================== --- gcc-5.orig/src/gcc/testsuite/gcc.dg/pragma-align-2.c +++ gcc-5/src/gcc/testsuite/gcc.dg/pragma-align-2.c @@ -26,9 +26,9 @@ void abort (void); #pragma align bad_align /* { dg-warning "malformed" } */ #pragma align 1(bad_align /* { dg-warning "malformed" } */ -int x, x1, x2, x4, x8, y8, z8, x16, x32, x64, x128, y128, z128; +int x1, x2, x4, x8, y8, z8, x16, y16, x32, x64, x128, y128, z128 -#pragma align 16(x) /* { dg-warning "must appear before" } */ +#pragma align 16(y16) int main () @@ -48,6 +48,9 @@ main () if (__alignof__ (x16) < 16) abort (); + if (__alignof__ (y16) < 16) + abort (); + if (__alignof__ (x32) < 32) abort ();