[llvm-bugs] [Bug 37208] New: msan: incorrect function/location/name for stack variables

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 23 00:59:18 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37208

            Bug ID: 37208
           Summary: msan: incorrect function/location/name for stack
                    variables
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: dvyukov at google.com
                CC: llvm-bugs at lists.llvm.org

#include <stdio.h>

int foo()
{
        volatile int x;
        return x;
}

int bar()
{
        return foo();
}

int main()
{
        printf("start\n");
        int x = bar();
        if (x)
                printf("here\n");
        return 0;
}

$ clang -v
clang version 7.0.0 (trunk 326052)
$ clang test.c -fsanitize=memory -fsanitize-memory-track-origins -g -O2
$ ./a.out

==261759==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x499cda in main test.c:18:6

  Uninitialized value was created by an allocation of 'x.i.i' in the stack
frame of function 'main'
    #0 0x499c20 in main test.c:15

SUMMARY: MemorySanitizer: use-of-uninitialized-value test.c:18:6 in main

The variable is called 'x', not 'x.i.i'.
The variable is allocated in function 'foo', not 'main'.
The variable is allocated at line 5, not 15. 15 does not even hint at the
inlined function that allocated the variable.

-- 
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/20180423/8db5dc3b/attachment.html>


More information about the llvm-bugs mailing list