[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


            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"
  return 1;

int a(int (*b)(void))
  return b();

  int i;
  for (i=0; i<1000000;i++)
  printf ("%i\n",i);

With -O2 -fPIC is compiled as (on Linux):
m:                                      # @m
# BB#0:
        pushq   %rax
        .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

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