[llvm-bugs] [Bug 27005] New: Dead store elimination incorrectly removes store to function pointer in struct
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Mar 20 09:52:27 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27005
Bug ID: 27005
Summary: Dead store elimination incorrectly removes store to
function pointer in struct
Product: libraries
Version: 3.8
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: maniandram01+bugzilla at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 16057
--> https://llvm.org/bugs/attachment.cgi?id=16057&action=edit
Code that causes the miscompilation
In the attached code incorrect_dse.ll, the dead store elimination optimization
incorrectly removes in create() a store instruction to a function pointer in
the structure {void()*}, even though that pointer is load'ed later in main().
This may be due to the bitcast to the structure {} later. This removal of the
store instruction does not occur if the function is replaced with an i32. Note
that one can add a dummy i32 to both {} and {void()*} structures, but the big
still occurs (it has nothing to do with {} being empty).
The end result of this miscompilation is a segmentation fault. However, if one
uses -O2 and -O3 levels, LLVM recognizes that the function being load'ed is
undefined and hence optimizes away main() to `ret undef`.
You can reproduce the problem with: opt bugpoint-tooptimize.bc -dse
I am using the Clang 3.8 binaries for Ubuntu 15.10 downloaded from llvm.org.
bugpoint_out.txt is from running:
~/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-15.10/bin$ ./bugpoint -llc-safe -dse
~/incorrect_dse.ll > bugpoint_out.txt
I have also attached the bitcode files bugpoint-tonotoptimize.bc and
bugpoint-tooptimize.bc generated by bugpoint.
--
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/20160320/edf58943/attachment.html>
More information about the llvm-bugs
mailing list