<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/101036>101036</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            MemorySanitizer false positive on function call
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ccotter
      </td>
    </tr>
</table>

<pre>
    MSAN appears to report a false positive when passing an uninitialized value to a function that's defined in another translation unit.

```
// other.cpp
void call_other_TU(int) {}

// main.cpp
void call_same_TU(int){}
void call_other_TU(int);

int main() {
    int a;
 call_same_TU(a);
    call_other_TU(a);
    return 0;
}
```

```
Program returned: 1
==1==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55555561ede5 in main /app/main.cpp:7:5
    #1 0x7ffff7829d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 490fef8403240c91833978d494d39e537409b92e)
    #2 0x7ffff7829e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 490fef8403240c91833978d494d39e537409b92e)
    #3 0x5555555862e4 in _start (/app/build/the_executable+0x322e4)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /app/main.cpp:7:5 in main
Exiting
```

I'm not sure if this is a known limitation (could not find anything in the docs) or intentionally flagged, as the use case seems relatively mundane. As far as I can tell, the program behavior is not observably impacted by the uninitialized value.

https://godbolt.org/z/oGdxhj9Yj
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU9v27gT_TT0ZWCDImX9Oejg_PJzkUOKRbvFoieDIkcWsxQpkJRj59MvKDuJ43YLFFjDkCDOzHuPw-GMCEHvLWJD1ndkfb8QU-ydb6R0MaJftE6dmsevm88gxhGFDxAdeBydjyCgEyYgjC7oqA8Izz1aGBOi3YOwMFltddTC6BdUcBBmwhQuoJusjNpZiL2IhJU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