delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/12/27/03:38:58

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Thu, 27 Dec 2001 10:38:10 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Tim Van Holder <tim DOT van DOT holder AT pandora DOT be>
cc: djgpp-workers AT delorie DOT com
Subject: Re: gcc 3.03 and libc sources
In-Reply-To: <000701c18e67$72043aa0$cef8e0d5@zastaixp>
Message-ID: <Pine.SUN.3.91.1011227103721.19068A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019