#305 Division by power of 2 fails with neg nu

closed-fixed
Johan Knol
5
2013-05-25
2002-03-02
Michael Hope
No

See the regression tests under this number.

The front end optimises division by a constant power of two as in:

volatile int left;

left = -18;
ASSERT(left/4 == (-18/4));

However, if left is negative then shifting and division are not equivalent.

The optimisation still holds if left is unsigned.

Discussion

  • Johan Knol
    Johan Knol
    2002-03-03

    Logged In: YES
    user_id=63512

    fixed in SDCCicode.c:1.132

     
  • Johan Knol
    Johan Knol
    2002-03-03

    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed