Mail Archives: djgpp-workers/2001/12/27/03:38:58
On Thu, 27 Dec 2001, Tim Van Holder wrote:
> In any case, this is the code that decides to emit the warning:
>
> [c-typeck.c, around line 3525]
> /* If -Wsign-compare, warn here if type1 and type2 have
> different signedness. We'll promote the signed to unsigned
> and later code won't know it used to be different.
> Do this check on the original types, so that explicit casts
> will be considered, but default promotions won't. */
Thanks for looking this up.
I don't consider myself a C language lawyer, but it sounds like a bug:
why does GCC have to promote to unsigned in the case of the ?:
expression. That is only true in the case of "op1 RELOP op2"
expression, where RELOP is ==, =>, etc. It's possible that GCC
mistakenly grafts the ?: operator into the same condition, when it
shouldn't.
Would someone please post a message to the GCC list?
> The only potential issue seems to be that the promotions involved may
> turn the return type into something that might be undesirable.
There's no promotion involved in ?:, at least there shouldn't be a
promotion.
- Raw text -