<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Sanitizers don't work with ThinLTO and new pass manager at opt level > 0"
   href="https://bugs.llvm.org/show_bug.cgi?id=46418">46418</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Sanitizers don't work with ThinLTO and new pass manager at opt level > 0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tomasz.miasko@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, yuanfang.chen@sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>yuanfang.chen@sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When using ThinLTO and -fexperimental-new-pass-manager at optimization 
level > 0, sanitizer passes are registered using
registerOptimizerLastEPCallback
but the pre-link pipeline constructed with buildThinLTOPreLinkDefaultPipeline
doesn't include optimization pipeline and those callbacks are never invoked.
Thus the sanitizer instrumentation is not performed at all.

Example:

$ cat a.cpp
#include <string.h>
int main(int argc, char **argv) {
  char x[10];
  memset(x, 0, 10);
  int res = x[argc * 10];
  return res;
}
$ clang -fexperimental-new-pass-manager -flto=thin -fsanitize=address -O1 a.cpp
$ ./a.out
$ # No error report.</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>