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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to