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

    <tr>
        <th>Summary</th>
        <td>
            [clang++] Clang not emitting diagnostic warning for possible integer overflow
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

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

<pre>
    Consider the following code:

```cpp
#include "stdint.h"

void ST_WriteReg(uint16_t reg, uint8_t* bytes, uint32_t size);

void ST_SetCursor(uint16_t x, uint16_t y) {
    uint8_t param[4];
 param[0] = 0x00;
    param[1] = 0x00 + x;
    param[2] = 0x00;
 param[3] = 0xEF + x;
    ST_WriteReg(0, param, 4);
    param[0] = 0x00;
    param[1] = 0x00 + y;
    param[2] = 0x00;
    param[3] = 0xEF + y;
    ST_WriteReg(0, param, 4);
}
```

even with all warnings (-Wall -Wextra -Wpedantic) turned on, no warning is emitted for assigning the promoted (u16) to the u8 array.
is this the intended behavior? if not, I'd like to take on this.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVEuvszYQ_TVmM0pkBgjJgsVNaKRueytlGRk8Afc6NrJNHv31lcnjpm0235WQ0bzOzDl-CO9VZ4gqVqxZUSdiDL11lRZH4ZxLGiuv1cYaryQ5CD3BwWptz8p00FpJLPtgvGb8sS747WuH4e7BTJlWj5KAIfoglQnzniG-lp2skvD5537nVKA_qGO4HJUJ6WIfwEVzA9Fe7gPDD2iugfzDl-E-gFd_E8MVy9bvUD8pbEbnrXuFvTwAJuvKcAWsvJcDwKMfDMKJIyvWOSvqJ_7Ty1lRA8tq4BfOv8MAz4z0NQMYruHyNg_fIz3C2Xf4t-0bmH-LxyO5WyluIH-V5rXnT6a__sr0Lxn_J3D9GQFW1v85a697TicycFahB6E1nIUzynQeGC5nu-iZ7egSnIDZbiApTFBt3PkwOkMSrIndjH3UgfJARxUCSThYB7e7EgPxIgzOHm0MxWOVLiYcO0XGJQjnxHV-m0l5CP20ECgTyEiS0FAvTso6lm1BHcDYEHv_zrCUoNUXTVjii8CaqfqOlcgqk6tsJRKq0jLFArHIMOmrfJE1B56XC2pSbARHkR5IprngMl9hWiSqQo45z3mJPMcU50hlueCY5VlaHAQnlnM6CqXnWp-Oc-u6RHk_UrUsV3maaNGQ9tMrgdhqYbp4h4s6cVXMnzVj51nOtfLBfyMEFfT0tNwr1vErathEM5K-6RsllUp0xvqg2qf8UfPBeq8afVOuIwf2RO6g7TkZna76EAYf3yDcMtx2KvRjM2_tkeE2znD_zQZn_6I2MNxOlDzD7cTqnwAAAP__sOJ0BQ">