<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 - sanitizer=undefined output the variable name"
   href="https://bugs.llvm.org/show_bug.cgi?id=40425">40425</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>sanitizer=undefined output the variable name
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jg@jguk.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21368" name="attach_21368" title="Test case for bool sanitize undefined">attachment 21368</a> <a href="attachment.cgi?id=21368&action=edit" title="Test case for bool sanitize undefined">[details]</a></span>
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);
}</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>