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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to