This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Undefined behavior in 950605-1.c
- From: Momchil Velikov <velco at fadata dot bg>
- To: gcc at gcc dot gnu dot org
- Date: 25 Jul 2002 09:22:02 +0300
- Subject: Undefined behavior in 950605-1.c
IMHO, gcc.c-torture/execute/950605-1.c (pasted below) provokes
undefined behavior according to ISO 9899:1999 6.5.2.2 [#6]
... If the function is defined with a type that does not
include a prototype, and the types of the arguments after
promotion are not compatible with those of the parameters after
promotion, the behavior is undefined, except for the following
cases:
-- one promoted type is a signed integer type, the other
promoted type is the corresponding unsigned integer type,
and the value is representable in both types;
f (c)
unsigned char c;
{
if (c != 0xFF)
abort ();
}
main ()
{
f (-1);
exit (0);
}
IOW, the value -1 is not representable in the promoted type of the
formal parameter of ``f''.
Comments?
~velco