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

    <tr>
        <th>Summary</th>
        <td>
            False positive garbage value from a constructor with inheritance
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:static analyzer,
            false-positive
      </td>
    </tr>

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

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

<pre>
    After constructing `A` with default constructor Clang Analyzer thinks the `a.bytes` contains a garbage value. This can later cause reporting warnings like:
- Assigned value is garbage or undefined
- Undefined or garbage value returned to caller
- The left operand of [...] is a garbage value

https://godbolt.org/z/3cerPT64a

```cpp
struct B {
 unsigned char bytes[1];
};

struct A : B {
    explicit A() : B{{0}} {}
};

auto test1(unsigned char& o) {
    A a;
    o = a.bytes[0];
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U02PpDgM_TXmYjWCQIA6cKCmxHkPvT_ABAPZSScoCT3b8-tXQNd0V0krIT4cv_f8jE0h6NkytyCvIG8JbXFxvlXLRCEmgxs_2m6K7FE5G6LfVNR2RqiyDqoMf-m44MgTbSZ-ZTiPPwzZGTtL5uM3e4yLtj8DxoV3KKXDR-SwEyhnI2kbkHAmP9DM-E5m4xRfFx1QkUVDhzxtgdHz6vxRwS_yVts5oNE_GYoOshtk3Qt2p5_xpEEd_vA6j5sdedKWx3v23_fAfvpQAHqOm99PokNFxrC_g14XRsNTRLeyJzuimxDkNU1TkLdd8cnLiTvvS4xr2MsVPYh-duPgTEydn0H0v0H0hWL_12tV0ncQVNl5qXU9I2ef8YpQX88IbvbTuFrI49lgec1B3qD4zIH62_t3ng6h6B7YEJH_XY1WOmIHogFxOXP2lPqa7VT17QDUt_9jpy06jBxiDqJ5qA9Ehe7g_K7YIf1h2L8dQnHD-7TIa_Zs5rE7ydgW46W4UMJtXtXZpchEXSZLK4cLyUpSUTYjlbkkUWdCNnmTN6Iq1JDoVmRC5CIv8jyvZZkqMciqkY0sSTSXIocy4zfSJjXm_W3_XYkOYeNWXspLkRga2IRjg4RQ--RD0YVIUSukzxUAIUD8ACEmMoFfVhd01O-8h-Ut8e1O_DJsc4AyMzrE8CUVdTTc9jsO77inYZ28e0N62MBjNbVd2OtIVnGyedM-jZ-Oyzakyr2B6He5z8fL6t0_rCKI_rAZQPSH0_8CAAD__6oNRwM">