[llvm-bugs] [Bug 52382] New: ASAN Instrumentation removed when using optimizations

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 2 15:59:20 PDT 2021


            Bug ID: 52382
           Summary: ASAN Instrumentation removed when using optimizations
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mvanotti at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

The following code does not emit clang instrumentation when compiling with

#include <cstdlib>

int global_array[100] = {-1};

int main(int argc, char **argv) {
  return global_array[std::atoi("3") + 100];  // global buffer overflow

Code generated with `-fsanitize=address -O -g`

main:                                   # @main
        mov     eax, dword ptr [rip + global_array+412]

Shouldn't the code have asan instrumentation? When compiling with `-O0` the
instrumentation is there, as well as compiling with `-flegacy-pass-manager`

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/20211102/1d4e822b/attachment.html>

More information about the llvm-bugs mailing list