[PATCH] D78952: [LangRef] Describe linkage types, allocation size of declarations for global variables
Matthias Schiffer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 22:37:08 PDT 2020
NeoRaider added a comment.
In D78952#2006342 <https://reviews.llvm.org/D78952#2006342>, @efriedma wrote:
> 1. Global variables are not allowed to overlap. (This follows from the pointer aliasing rules.)
Makes sense, I'll add this.
> 2. The alignment does have to match the declared alignment. And the "declared" alignment is implicitly computed based on the type if it isn't explicitly specified.
Question regarding alignment: I would expect that a variable declaration with lower alignment than the definition it refers to should be fine. For example, when declaring an extern global variable of a forward-declared struct type in C, clang will use an opaque type with alignment 1 for the declaration.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78952/new/
https://reviews.llvm.org/D78952
More information about the llvm-commits
mailing list