<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - addrspec causes incorrect load/store with optimization on"
   href="http://llvm.org/bugs/show_bug.cgi?id=18032">18032</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>addrspec causes incorrect load/store with optimization on
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tobias.haegermarck@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>