#2190 regression test bug1057979 fails with rule 1


When enabling peephole rule 1 (replaces jp by jra), the regression test bug1057979 fails for stm8.

I currently do not know why, but I guess there is an issue with the jump range calculation, resulting in a replacement where it shouldn't happen. But this would also mean that there is another bug in the linker, where the linker does not issue an error message for an out-of-range jra.

I observed this issue in sdcc revision #8720.



  • Maarten Brock

    Maarten Brock - 2013-12-27
    • Category: other --> STM8
  • Ben Shi

    Ben Shi - 2014-03-10
    1. How to reproduce it or it is already fixed? In rev 8953, the (jp -> jpa) peephole rule is enabled, and the regression test bug1057979 succeeds on stm8.

    2. the jp instruction will be affected by the linker, but the jra is fully handled by the assembler only.

    3. The labelInRange() seems no very accurate. With the attachment (jp.c and jra.c in the zip file), the (jp -> jra) peephole rule is applied in jra.c, while not in jp.c. However in jp.c, the destination of the last jp instruction is still in range -128 to 127.

  • Ben Shi

    Ben Shi - 2014-07-09
    • status: open --> closed-fixed
  • Ben Shi

    Ben Shi - 2014-07-09

    I close this ticket, since

    1. The regression test bug1057979 now succeeds on stm8 / rev9042.

    2. The jp->jra peephole works, though not very accurate. (The jump range is (-115, 114)).

    3. The destination of JP is calculated by the linker, but JRA's is fully handled by the assembler.


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks