https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64236
Bug ID: 64236 Summary: Missing alignment Product: gcc Version: 4.8.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: wolfgang.roe...@gi-de.com Hi, I would like to post a bug report for the GNU C/C++ compiler 4.8.3. We use the compiler to generate code for a PowerPC processor. Invokation line for the GNU C++ compiler: ccppc -c -x c++ -std=c++11 -Wall -Werror -g -mcpu=8540 -meabi -ftls-model=local-exec -msdata=sysv -fno-common -mspe -mabi=spe -mfloat-gprs=double -mbig -mmultiple -mno-string -misel -mstrict-align -fverbose-asm -fno-exceptions -fno-rtti -fgcse-sm -fno-section-anchors -ftemplate-backtrace-limit=20 -G 8 -O3 -I<some include paths> -D<some #define's> X.CPP -oX.O // file X.CPP #define SIZE_DATA_CACHE_BLOCK 32u struct S { double d; }; struct alignas(sizeof(S)) S1 { char d[sizeof(S)]; }; struct alignas(SIZE_DATA_CACHE_BLOCK) alignas(sizeof(S)) S2 { char d[sizeof(S)]; }; alignas(S) char s1[sizeof(S)]; alignas(SIZE_DATA_CACHE_BLOCK) alignas(S) char s2[sizeof(S)]; S1 s3; S2 s4; An inspection of the generated assembler file (see below) shows the following alignments: . s1: alignment = 8 . s2: alignment = 32 . s3: alignment = 8 . s4: alignment = 8 ??? I think that s4 should also be aligned on a 32-byte boundary (C++11 standard, 7.6.2/4). Following is the generated assembler file: .globl s4 .section ".sbss","aw",@nobits .align 3 <--- 8-byte alignment ??? s4: .zero 8 .size s4, 8 .type s4, @object .globl s3 .align 3 <--- 8-byte alignment s3: .zero 8 .size s3, 8 .type s3, @object .globl s2 .align 5 <--- 32-byte alignment s2: .zero 8 .size s2, 8 .type s2, @object .globl s1 .align 3 <--- 8-byte alignment s1: .zero 8 .size s1, 8 .type s1, @object Kind regards W. Roehrl