[llvm-bugs] [Bug 43983] New: Alignment specifier not applied to anonymous structure or union
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 12 13:20:45 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=43983
Bug ID: 43983
Summary: Alignment specifier not applied to anonymous structure
or union
Product: clang
Version: 9.0
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: omrimor2 at illinois.edu
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 22802
--> https://bugs.llvm.org/attachment.cgi?id=22802&action=edit
minimal example
The _Alignas specifier is not being applied to anonymous structures or unions.
If the structure or union is given a declarator then the alignment specifier is
correctly applied. This is a useful construct in that it allows for alignment
of portions of a structure.
#include <stdio.h>
struct A { struct { int a; }; };
struct B { _Alignas(64) struct { int b; }; };
struct C { _Alignas(64) struct { int c; } x; };
int main(int argc, char *argv[])
{
printf("%zu %zu %zu\n",
sizeof(struct A), sizeof(struct B), sizeof(struct C));
return 0;
}
Should output "4 64 64" on an LP64 platform; instead outputs "4 4 64". GCC 9
compiles correctly. I haven't yet tested on platforms other than macOS.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191112/88912691/attachment.html>
More information about the llvm-bugs
mailing list