[llvm-bugs] [Bug 40425] New: sanitizer=undefined output the variable name

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 23 02:58:32 PST 2019


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

            Bug ID: 40425
           Summary: sanitizer=undefined output the variable name
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jg at jguk.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 21368
  --> https://bugs.llvm.org/attachment.cgi?id=21368&action=edit
Test case for bool sanitize undefined

Can santizer include the variable name in output to make it clearer?

There might be many variables on the same line

Often we see something like this:

src/my.cpp:2585:75: runtime error: load of value 127, which is not a valid
value for type 'bool'

at carat 75 we find mystruct.mybool
                             ^
carat 75 is mybool.

But it would seem the information is already available to give more
information?

Is the code something like this that is inserted? before line 2585?

if(0 != (size_t)mystruct.mybool && 1 != (size_t)mystruct.mybool)
{
    printf("%s:%zu:%zu: runtime error: load value of %zu, which is not a valid
value for type 'bool'\n", file, line, carat, (size_t)mybool);
}

Attached a little example which demonstrates


So could it be changed to something better?, eg:

if(0 != (size_t)mystruct.mybool && 1 != (size_t)mystruct.mybool)
{
    printf("%s:%zu:%zu: runtime error: mystruct.mybool load value of %zu, which
is not a valid value for type 'bool'\n", file, line, carat, (size_t)mybool);
}

-- 
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/20190123/a21bd3f1/attachment.html>


More information about the llvm-bugs mailing list