[llvm-bugs] [Bug 35352] New: RTTI cxxabi pointers are 'external global i8*', but are referenced using 'getelementptr inbounds' with index '2'
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 17 11:02:32 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35352
Bug ID: 35352
Summary: RTTI cxxabi pointers are 'external global i8*', but
are referenced using 'getelementptr inbounds' with
index '2'
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: ahmed.bougacha at gmail.com
CC: llvm-bugs at lists.llvm.org
Take a simple class:
class A { virtual void f1(); };
void A::f1() { }
With RTTI enabled, we emit a reference to the libcxxabi RTTI base:
@_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
and later use it in a GEP:
@_ZTI1A = constant ... { ... i8** getelementptr inbounds (i8*, i8**
@_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), ... }
Is that correct? As far as IR is concerned, the global is only 8-bytes wide.
LangRef says:
If the inbounds keyword is present, the result value of the getelementptr is
a poison value if the base pointer is not an in bounds address of an allocated
object
The object isn't allocated in this module, and irgen knows that the allocated
object is large enough. But still, it seems fishy. I haven't found anything
conclusive either way in the GEP/pointer aliasing rules.
--
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/20171117/57d43fbb/attachment.html>
More information about the llvm-bugs
mailing list