[LLVMbugs] [Bug 11081] New: alias is miscompiled with -fPIC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 6 14:24:24 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11081

           Summary: alias is miscompiled with -fPIC
           Product: new-bugs
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu


I think that aliases are miscompiled when -fPIC is used. 
Here is the minimized example (llvm r140360): 

----------------
; ModuleID = 'a.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
@GLOBAL = global { i32, [60 x i8] } zeroinitializer, align 32
@ALIAS = alias internal getelementptr inbounds ({ i32, [60 x i8] }* @GLOBAL,
i32 0, i32 0)
define i32* @foo() nounwind uwtable readnone {
entry:
  ret i32* @ALIAS
}
----------------
$ llc -relocation-model=pic a.ll && grep ALIAS a.s

    leaq    ALIAS(%rip), %rax

The generated code should look more like 
    movq    ALIAS at GOTPCREL(%rip), %rax

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list