https://bugs.llvm.org/show_bug.cgi?id=45681
Bug ID: 45681
Summary: Request for LangRef clarification: allocation size of
global variable declaration
Product: Documentation
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: General docs
Assignee: unassignedb...@nondot.org
Reporter: mschif...@universe-factory.net
CC: llvm-bugs@lists.llvm.org
Working on Rust, we have come across the question whether LLVM makes any
assumptions about the allocation size of declared global variables based on
their type when the definition is unknown (or, turning it around, if it is
guaranteed that LLVM makes no such assumptions).
It seems fine to access data (for example using getelementptr inbounds) past
the "end" of such a global variable at least on some cases - I've noticed that
clang compiles a `extern char foo[];` to `@foo = external global [0 x i8],
align 1` (and a comment in llvm/test/Analysis/BasicAA/global-size.ll backs
this).
What is not entirely clear to us is whether such accesses are *always* valid
(given that a definition of appropriate length comes in at link time), in
particular:
- when the length of the declared type is not 0
- when the declared type is not an array, but a struct, and the last element of
the struct is no array
If all of this is indeed valid, it would be great if such a statement could be
added to the LangRef.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs