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

    <tr>
        <th>Summary</th>
        <td>
            analyzer: Thinks result of `__builtin_mul_overflow` can be uninitialized
        </td>
    </tr>

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

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

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

<pre>
    ```c++
#include <stddef.h>

int test(size_t nel, size_t elsz) {
  size_t nbytes;
  int overflow = __builtin_mul_overflow(nel, elsz, &nbytes);
  int overflow2 = __builtin_add_overflow(nel, nbytes, &nbytes);
  return overflow * overflow2;
}
```

```
> clang++ --analyze -Xclang -analyzer-output=text -std=c++20
clang++: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
<source>:6:19: warning: 2nd function call argument is an uninitialized value [core.CallAndMessage]
    6 |   int overflow2 = __builtin_add_overflow(nel, nbytes, &nbytes);
      | ^                           ~~~~~~
<source>:4:3: note: 'nbytes' declared without an initial value
    4 |   size_t nbytes;
      | ^~~~~~~~~~~~~
<source>:5:18: note: Assuming overflow
    5 |   int overflow = __builtin_mul_overflow(nel, elsz, &nbytes);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:6:19: note: 2nd function call argument is an uninitialized value
    6 |   int overflow2 = __builtin_add_overflow(nel, nbytes, &nbytes);
      |                   ^ ~~~~~~
1 warning generated.
Compiler returned: 0
```

Godbolt: https://godbolt.org/z/4q4Efcax8
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lc2SozYQx5-mfenCBRIYOHBg7XFOOSVVSeXiEqiNlZXFRB8zOz7ss6dkYMc749lDkkoXZRs1_nX_u1tCOKcGQ9RA8QmK3UoEfxpt8wcZb9XnVTfKlwY26XT1wD7FK22BcWV6HSQh8K3zUtJxfQL-EH1pq4xHT84Dq5y60MGjIQ1si_MdaXcBViOUEYbLsulePDng02KEjE9kj3p8RuA7PBy6oLRX5nAO-rC4gFUzfKJuEdhmJrH6Hoy9oQkp79AWxH2eJR-sucmPta_86SEod_FzKd5Ume9u-QP2WphhKismiTBCv1wIk9-v67gs2GQM_jF44DtPXzwmzkvgu7kfLMJuQMBbfBbWKDPEn8IO4UzGYzDBkUQZrDID9uP5UWnh1WjiU8DK5BdgJULxKfltejTpx_NZGJloZShZOFBcdfGtG4PtKTadtxvgbVa_icyMxGMwfYyBvdD6NRflUBgMRhnlldDqQhKfhA4U4_ejpfVWaN0a-TM5JwaagiIibhDKLf73HY0WyVA84Mf29Wrv9efAWx41m9HTXM8lRImSei0sSXxW_jQGH7XPyifVcwb5rO3ufrhJ8OuNvc-liL2obpNpnQvn2PRvRZmAxZ1a_uut9kGeP7QfDdQi4p9M0_80M-8tTtE3admyKXAgQ1Z4kmtI2-11B5KdDxOSUWX6_sz4aZTdqH30nrx_dMBbYHtg-2FyrEc7ANtfgO3zv_KHYy--VCvZcFnzWqyoyco8r8uc82p1aqqqPPZFl2bECimLY5VnnaizTAi56dK6WqmGpaxI86zKsrTg1bqvBSspK1ia9XlPFeQpnYXSa62fzjH2SjkXqMn4htVspUVH2l3fJ4wZesarFxiLrxfbxD8lXRgc5KlWzrtXjFdeU7MceVHurydlPju05IL2OB4RNukHo7lJsRcGO_p-DFbB6uZN1ZQ_hW7dj2dg-xh8_koe7fgn9R7Y_pqyA7afNT017O8AAAD__9OjP9c">