<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Uninitialized bytes from clang_createIndex"
   href="https://llvm.org/bugs/show_bug.cgi?id=30410">30410</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Uninitialized bytes from clang_createIndex
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.9
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libclang
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>markus.zimmermann@nethead.at
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17279" name="attach_17279" title="failure.c">attachment 17279</a> <a href="attachment.cgi?id=17279&action=edit" title="failure.c">[details]</a></span>
failure.c

We (<a href="https://github.com/go-clang">https://github.com/go-clang</a> automatic generated bindings for Clang's C API
for Go) are in the process of adding address sanitizer checks into our test
process. Before we do a public release, we want to make sure that we did
nothing wrong. However, by using the address sanitizer I found that an instance
of "uninitialized bytes".

The attached program compiled with

clang -I `llvm-config --includedir` -lclang -g -fsanitize=memory
-fsanitize-memory-track-origins -fno-omit-frame-pointer failing.c -o failing

produces the following output:

$ ./failing 
Uninitialized bytes in __interceptor_memchr at offset 6 inside [0x70800000bf58,
7)
==1796==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7ff7dd302c85  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x653c85)
    #1 0x7ff7dd3130a7  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x6640a7)
    #2 0x7ff7e1242bbe  (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0xc05bbe)
    #3 0x7ff7e12524ca  (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0xc154ca)
    #4 0x7ff7e0acdf39  (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x490f39)
    #5 0x7ff7e0aab504  (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x46e504)
    #6 0x7ff7e08a078e  (/usr/lib/x86_64-linux-gnu/libclang-3.9.so.1+0x26378e)
    #7 0x7ff7dd2dd314  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x62e314)
    #8 0x7ff7dd2dd393  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x62e393)
    #9 0x7ff7dd3404bc  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x6914bc)
    #10 0x7ff7e0427183  (/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
    #11 0x7ff7df82c37c  (/lib/x86_64-linux-gnu/libc.so.6+0xfa37c)

  Uninitialized value was stored to memory at
    #0 0x421635  (/home/vagrant/go/src/github.com/go-clang/failing+0x421635)
    #1 0x7ff7dca669bd  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbb9bd)

  Uninitialized value was stored to memory at
    #0 0x421635  (/home/vagrant/go/src/github.com/go-clang/failing+0x421635)
    #1 0x7ff7dca65e2f  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xbae2f)

  Uninitialized value was created by a heap allocation
    #0 0x41fc39  (/home/vagrant/go/src/github.com/go-clang/failing+0x41fc39)
    #1 0x7ff7dca09dac  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x5edac)

SUMMARY: MemorySanitizer: use-of-uninitialized-value
(/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x653c85) 
Exiting

I am using the packages of <a href="http://llvm.org/apt/trusty/">http://llvm.org/apt/trusty/</a>
llvm-toolchain-trusty-3.9

Please let me know if I should try anything. It would be great if we could get
rid of this problem, so that we can enable the address sanitizer checks.</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>