#425 implicit integral promotion not working

closed-fixed
Johan Knol
5
2013-05-25
2002-12-25
Tzvetan Mikov
No

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.

Discussion

  • 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
    user_id=63512

    fixed in SDCCast.c:1.150