This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Undefined behavior in 950605-1.c


>>>>> "Alan" == Alan Modra <amodra@bigpond.net.au> writes:

Alan> On Thu, Jul 25, 2002 at 12:53:59PM +0300, Momchil Velikov wrote:
>> representable if the promoted type of the parametar is unsigned.

Alan> Ah, but what is the promoted type of "unsigned char"?  int!

ISO/IEC 9899:1999 6.5.2.2 [#6]

  " ... the other promoted type is the corresponding unsigned integer
  type, ..."

IMHO, that means that it is legal for the promoted type of ``unsigned
char'' to be ``unsigned int''.  Isn't that the case with architectures
with a definition of PROMOTE_MODE, which does not change UNSIGNEDP or
sets it to 1, e.g, ARM, PPC, V850 ?

Indeed it contradicts with 6.3.1.1 [#2]:

  "If an int can represent all values of the original type, the value
  is converted to an int; otherwise, it is converted to an unsigned
  int.  These are called the integer promotions."

~velco


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]