------- Comment #5 from Joey dot ye at intel dot com 2008-01-23 01:45 ------- (In reply to comment #2) > I bet if you put jj in struct and don't have a nested function, this will be > the same issue.
Not the same. In fact it passes if not referenced by a nested function. The root is in tree-nested.c $ cat nested-3.c #include <stdio.h> #include <stdlib.h> typedef int aligned __attribute__((aligned(16))); int global; void check (int *i) { *i = 20; if ((((int) i) & (__alignof__(aligned) - 1)) != 0) { printf("\nUnalign address (%d): %p!\n", __alignof__(aligned), i); abort (); } } void foo (void) { aligned jj; int j2; void bar () { j2 = -20; } jj = 0; bar (); check (&jj); } int main() { foo (); return 0; } $ diff -p nested-2.c nested-3.c *** nested-2.c 2008-01-22 14:24:39.000000000 +0800 --- nested-3.c 2008-01-23 09:38:47.000000000 +0800 *************** void *** 19,27 **** foo (void) { aligned jj; void bar () { ! jj = -20; } jj = 0; bar (); --- 19,28 ---- foo (void) { aligned jj; + int j2; void bar () { ! j2 = -20; } jj = 0; bar (); $ gcc -m32 -o nested-3.exe nested-3.c $ ./nested-3.exe $ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34921