[LLVMbugs] [Bug 18032] New: addrspec causes incorrect load/store with optimization on

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 22 09:41:38 PST 2013


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

            Bug ID: 18032
           Summary: addrspec causes incorrect load/store with optimization
                    on
           Product: libraries
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: tobias.haegermarck at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

To illustrate:
#include<stdio.h>
struct a { int foo; char *bar; };
struct b { a *foo; };
int main() { printf("%s", ((b
__attribute__((address_space(256)))*)0)->foo->bar); }

Compile with:
clang++ -O3 -c -emit-llvm -o - addrspec.cpp | llc -O1 -o - -

This generates the following instruction:
movq    %gs:8, %rsi

Which loads from outside of the 'b' structure (seems to assume that a is
located at %gs:0, which is incorrect).
If -O0 is instead passed to llc, the result is as expected (load 'foo' from b,
load 'bar' from a)

-- 
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/20131122/a2e0a455/attachment.html>


More information about the llvm-bugs mailing list