https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
wolter.hellmundvega at tevva dot com changed:
What|Removed |Added
CC||wolter.hellmundvega
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
Andrew Pinski changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
Manuel López-Ibáñez changed:
What|Removed |Added
CC||manu at gcc dot gnu.org
--- Commen
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
Daniele Alessandrelli changed:
What|Removed |Added
CC||daniele.alessandrelli@gmail
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
Georg-Johann Lay changed:
What|Removed |Added
Target|arm-elf-gcc |arm-elf-gcc,x86
Status|UNC
--- Comment #9 from michael dot malone at tait dot co dot nz 2009-02-24
00:43 ---
I forgot to mention, if you assign to an intermediate variable, the warning
also disappears which is the behaviour I would expect from an explicit cast.
--
michael dot malone at tait dot co dot nz chan
--- Comment #8 from michael dot malone at tait dot co dot nz 2009-02-24
00:40 ---
#ifdef UINT
#include
#define TYPE uint16_t
#else
#define TYPE unsigned short int
#endif
#define VALUE 0xFF
int main(void);
int main() {
TYPE variable_a = ~VALUE;
TYPE variable_b = VALUE;
--- Comment #7 from john dot carter at tait dot co dot nz 2009-02-23 23:53
---
R Guenther said...
> (int)u1 == (int)(u8_t)(~(int)u2)
>
> that we do not warn for the first case is because it is optimized to
>u1 == ~u2 before.
>
> Why do you think the warning is incorrect?
---
--- Comment #6 from rguenth at gcc dot gnu dot org 2008-12-02 12:12 ---
*** Bug 38370 has been marked as a duplicate of this bug. ***
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
---
--- Comment #5 from fredrik dot hederstierna at securitas-direct dot com
2008-12-01 13:35 ---
On Intel i386-GCC (4.2.3) we just get warning only for the line
if (c1 == ~c2)
The other lines does not give warnings, so maybe its just the ARM-backend that
catch this warning.
I guess yo
--- Comment #4 from fredrik dot hederstierna at securitas-direct dot com
2008-12-01 12:55 ---
Heres another example, then I do not think the warnings are due to
optimization.
I have same warnings with both -O0 and -O3.
#include
typedef unsigned char u8_t;
void test_cast(unsigned ch
--- Comment #3 from rguenth at gcc dot gnu dot org 2008-12-01 12:49 ---
As I said, for the first case we optimize away the promotions before the
warning
code comes along.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341
--- Comment #2 from fredrik dot hederstierna at securitas-direct dot com
2008-12-01 12:40 ---
Then why dont we get warning on the first if-statement?
Shouldnt these lines be equal?
if (c1 == (unsigned char)(~c2)) {
}
if (u1 == (u8_t)(~u2)) { // THIS WILL GIVE WARNING
}
The fi
--- Comment #1 from rguenth at gcc dot gnu dot org 2008-12-01 10:01 ---
/* Warn if two unsigned values are being compared in a size larger
than their original size, and one (and only one) is the result of
a `~' operator. This comparison will always fail.
Also warn if o
14 matches
Mail list logo