#1925 No code is generated for struct access on different ports

closed-fixed
None
7
2013-05-25
2012-02-01
syd
No

1 Code:

struct { char a; } x;
volatile char d = 7;

int
testBug(void)
{
char t = d;

x.a = t;
t = x.a + 2;
d = t;
t = x.a + 3;

return t; // result is 12 but have to be 10
}

2. sdcc test2.c
3. SDCC : mcs51/gbz80/z80/z180/r2k/ds390/pic16/pic14/TININative/ds400/hc08 3.1.2 #7271 (Feb 1 2012) (Linux)
4. ASM:
; test2.c:10: char t = d;
mov r7,_d
; test2.c:12: x.a = t;
mov _x,r7
; test2.c:13: t = x.a + 2;
inc r7
inc r7
; test2.c:14: d = t;
mov _d,r7
; test2.c:15: t = x.a + 3;
>
inc r7
inc r7
inc r7
; test2.c:17: return t;
mov a,r7
rlc a
subb a,acc
mov dpl,r7
mov dph,a
ret

Struct access is missed.

Discussion

  • syd

    syd - 2012-02-01

    test

     
  • Philipp Klaus Krause

    Increasing priority, since bad code is generated silently.

    Philipp

     
  • Philipp Klaus Krause

    • priority: 5 --> 7
     
  • Philipp Klaus Krause

    This is a bug in global common subexpression elimination, as can be seen from the --dumpall output.

    Philipp

     
  • Erik Petrich

    Erik Petrich - 2012-02-21

    Fixed in 3.1.2 #7336

     
  • Erik Petrich

    Erik Petrich - 2012-02-21
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     

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