http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59753

--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Manuel López-Ibáñez from comment #5)
> (In reply to Vincent Lefèvre from comment #4)
> > There's still an inconsistency without -Wpedantic, which is the point of
> > this bug. I've changed the bug title to:
> > 
> >   -Woverflow warning inconsistency with signed constant conversion between
> > T_MAX+1 and UT_MAX vs larger than UT_MAX
> 
> I seem to remember this inconsistency is due to the exact definition of
> overflow given in the standard.

Which definition?

As I understand the standard, there's no overflow in the integer constant:
65535 and 65536 are both of type int on the machine in question (C99,
6.4.4.1p5).

Then, in the assignment, there's a conversion of the value to type short (C99,
6.5.16.1p2). Concerning this conversion, since short is a signed integer type
and neither 65535 nor 65536 is representable in the type short, the behavior is
implementation-defined (C99, 6.3.1.3p3). I still don't see why the
inconsistency would be due to the definition of overflow.

Reply via email to