Issue 87941
Summary [clang++] Clang not emitting diagnostic warning for possible integer overflow
Labels clang
Assignees
Reporter lamarrr
    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.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to