#1119 code array access regressed

closed-fixed
5
2013-05-25
2006-05-15
Anonymous
No

Hi.

This is not a bug strictly speaking, but recently
some change was added to CVS, which enlarges my
prog so much that it no longer fits into a flash
rom.

This code (also attached) demonstrates the problem:
---
code unsigned char arr[] = { 1, 2, 3 };
unsigned char a = 1;
unsigned char main()
{
return arr[a];
}
---

Older sdcc:
---
mov dptr,#_arr
movc a,@a+dptr
; genRet
---

Newer sdcc:
---
mov a,_a
add a,#_arr
mov dpl,a
; Peephole 181 changed mov to clr
clr a
addc a,#(_arr >> 8)
mov dph,a
; genPointerGet
; genCodePointerGet
; Peephole 181 changed mov to clr
clr a
movc a,@a+dptr
; genRet
---

Discussion

  • Nobody/Anonymous

    test-case

     
  • Stas Sergeev

    Stas Sergeev - 2006-05-15

    Logged In: YES
    user_id=501371

    Logged in.

     
  • Maarten Brock

    Maarten Brock - 2006-05-17
    • labels: 355283 --> peephole optimizer
    • assigned_to: nobody --> maartenbrock
     
  • Maarten Brock

    Maarten Brock - 2006-05-17

    Logged In: YES
    user_id=888171

    Peephole rule 186.d had to be temporarily disabled to fix
    bug 1434401. I'll see if I can fix it better.

     
  • Maarten Brock

    Maarten Brock - 2006-05-18
    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2006-05-18

    Logged In: YES
    user_id=888171

    Peephole rule adapted and reenabled in SDCC 2.5.6 #4177.

     

Log in to post a comment.