http://llvm.org/bugs/show_bug.cgi?id=20116
Bug ID: 20116
Summary: Miscompilation when devirtualization is aborted due to
covariant return types
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 12699
--> http://llvm.org/bugs/attachment.cgi?id=12699&action=edit
A failing test case
When compiling the attached code, clang doesn't emit 'this' adjustment code for
'static_cast<A*>(z)' expression and ends up using a wrong vtable for the
virtual call. As a result, B.g() is called instead of Z.f().
Inspection of CodeGenFunction::EmitCXXMemberCallExpr() code shows that clang
can stop devirtualization in the middle if it finds out that return types are
covariant. At that moment, 'Base' expression that is later used for emission of
'this' pointer has already been assigned to 'Inner' expression (with casts
stripped), so no 'this' adjustment code is generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs