#425 implicit integral promotion not working


This is a followup to a recent bug I submitted. It has
been fixed in 2.3.2, but unfortunately 2.3.2 seems to be
broken in the reverse direction.

The code bellow should generate a full 16-bit result due
to implicit integral promotion.

unsigned func ( unsigned char a, unsigned char b )
return a + b;

In 2.3.2 the promotion is not performed and the result is
incorrectly truncated to 8-bits.

Note: I remember seeing something in the
documentation about deliberately disabling implicit
integral promotion for efficiency reasons. I hope that I
am mistaken, because it would be a very very very bad
idea (tm). The correct way to address the issue of
efficiency is by using typecasts, not by breaking the
language (and lots of working code). At least, it should
be a compiler option.


  • Johan Knol

    Johan Knol - 2002-12-28
    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed
  • Johan Knol

    Johan Knol - 2002-12-28

    Logged In: YES

    fixed in SDCCast.c:1.150


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks