[llvm-bugs] [Bug 45681] New: Request for LangRef clarification: allocation size of global variable declaration
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 26 15:00:57 PDT 2020
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: unassignedbugs at nondot.org
Reporter: mschiffer at universe-factory.net
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200426/0d3dc83c/attachment.html>
More information about the llvm-bugs
mailing list