[cfe-users] -Wconversion does not produce warnings when it should

2020-11-16 Thread Sven Köhler via cfe-users
Hi, consider the following code: uint16_t testa4(uint8_t x, uint8_t y) { return ( (uint16_t)x << 0 ) | ( (uint16_t)y << 8 ); } uint16_t testb3(uint16_t x, uint16_t y) { return x|y; } uint16_t testb4(uint16_t x, uint16_t y) { return x+y; } int testb4x(uint16_t x, uint16_t y

Re: [cfe-users] -Wconversion does not produce warnings when it should

2020-11-16 Thread Sven Köhler via cfe-users
Hi, > even though the two operands of the bitwise-or are both uint16_t. That's not true. I had many more versions of the test code before I posted here and I got confused. In testa4, the operands of the bitwise-or are both ints due to the bitshift which performs and integer promotion. Kind Rega

Re: [cfe-users] -Wconversion does not produce warnings when it should

2020-11-16 Thread Sven Köhler via cfe-users
Am 16.11.20 um 21:49 schrieb David Blaikie via cfe-users: > On Mon, Nov 16, 2020 at 12:36 PM Sven Köhler via cfe-users > wrote: >> >> Can you elaborate what is happening here? > > I believe/would guess the goal is to reduce false positives (where a > false positive is