<html>
    <head>
      <base href="https://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 --- - asan conflicts with gvn"
   href="https://llvm.org/bugs/show_bug.cgi?id=25550">25550</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>asan conflicts with gvn
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kcc@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kcc@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aizatsky@chromium.org, llvm-bugs@lists.llvm.org, stark@mit.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>[initially reported by Greg Stark:
<a href="http://lists.llvm.org/pipermail/llvm-dev/2015-November/092484.html">http://lists.llvm.org/pipermail/llvm-dev/2015-November/092484.html</a>]

Reproducer: 
typedef union {
  short q;
  struct {
    short x;
    short y;
    int for_alignment;
  } w;
} U;
int main() {
  char *buf = new char[2];
  buf[0] = buf[1] = 0x0;
  U *u = (U *)buf;
  return  u->q == 0 ? 0 : u->w.y;
}


gvn will speculatively combine two 2-byte loads into one, 
thus moving one of the loads outside of the conditional pass. 

We've seen these problems in the past, and have at least two guards against
those:
lib/Analysis/MemoryDependenceAnalysis.cpp:           
Attribute::SanitizeAddress))
lib/Analysis/ValueTracking.cpp:            Attribute::SanitizeAddress))

but none of these two help here.</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>