[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-17 Thread roberto dot gordo at gmail dot com
--- Comment #9 from roberto dot gordo at gmail dot com 2007-03-17 17:58 --- I would like to apologize for my faults in gcc bug report 31166, specially to the people who responded, and fully acknowledge my error. I've misunderstood your responses. Now, while reading them again, they

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-14 Thread roberto dot gordo at gmail dot com
--- Comment #5 from roberto dot gordo at gmail dot com 2007-03-14 08:52 --- unsigned is never promoted, it always stays unsigned. Sorry to insist, but I'm still not convinced. Please, see these examples, compiled with -std=c99. { unsigned u; int i; u = 1; /* this is an

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-14 Thread roberto dot gordo at gmail dot com
--- Comment #6 from roberto dot gordo at gmail dot com 2007-03-14 09:27 --- I think I've found something. According to the ISO C standard, a decimal constant without suffixes should ALWAYS be signed int (or signed long long if it does not fit), but never be unsigned! An octal or

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-14 Thread roberto dot gordo at gmail dot com
--- Comment #7 from roberto dot gordo at gmail dot com 2007-03-14 09:40 --- That's OK, it is not a bug, sorry. -- roberto dot gordo at gmail dot com changed: What|Removed |Added

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-14 Thread roberto dot gordo at gmail dot com
--- Comment #8 from roberto dot gordo at gmail dot com 2007-03-14 12:29 --- I'm still unable to match the behavior of gcc with the ISO C standard. I will try to explain myself. The reason for which gcc produces different results with hex constants is now clear. Also, in the following

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-13 Thread schwab at suse dot de
--- Comment #1 from schwab at suse dot de 2007-03-13 20:22 --- 0x8000 is of type unsigned int, negating it gives an unsigned int of the same value, converted to long long still gives the same positive value. On the other hand 2147483648 is of type long long (in C99) because it does

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-13 Thread roberto dot gordo at gmail dot com
--- Comment #2 from roberto dot gordo at gmail dot com 2007-03-13 22:27 --- I do not agree at all. Please, read. So 0x8000 is unsigned because does not fit on an int type. That's OK. If negating it gives an unsigned int of the same value, then, how do you explain that the

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-13 Thread schwab at suse dot de
--- Comment #3 from schwab at suse dot de 2007-03-13 22:35 --- (In reply to comment #2) So 0x8000 is unsigned because does not fit on an int type. That's OK. If negating it gives an unsigned int of the same value, then, how do you explain that the following code prints n1 =

[Bug c/31166] Integer hex constant does not follow promoting rules

2007-03-13 Thread pinskia at gcc dot gnu dot org
--- Comment #4 from pinskia at gcc dot gnu dot org 2007-03-13 22:35 --- unsigned is never promoted, it always stays unsigned. So -0x8000 == 0x8000 :). Try adding ULL (or UL) if you want an unsigned long long (unsigned long) constant. --