[LLVMbugs] [Bug 19405] New: Invalid optimization with -fPIC
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Apr 11 13:38:24 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19405
Bug ID: 19405
Summary: Invalid optimization with -fPIC
Product: libraries
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: hubicka at ucw.cz
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
#include "stdio.h"
int
b(void)
{
return 1;
}
int a(int (*b)(void))
{
return b();
}
m()
{
int i;
for (i=0; i<1000000;i++)
i+=a(b);
printf ("%i\n",i);
c();
}
With -O2 -fPIC is compiled as (on Linux):
m: # @m
.cfi_startproc
# BB#0:
pushq %rax
.Ltmp3:
.cfi_def_cfa_offset 16
leaq .L.str(%rip), %rdi
movl $1000000, %esi # imm = 0xF4240
xorb %al, %al
callq printf at PLT
xorb %al, %al
popq %rdx
jmp c at PLT # TAILCALL
.Ltmp4:
This is not valid, since ELF interpositionallows you to replace a by different
function returning different value.
--
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/20140411/114ac309/attachment.html>
More information about the llvm-bugs
mailing list