#2133 No warning but wrong code generated

closed-fixed
None
Front-end
5
2013-12-22
2013-02-16
workify
No

typedef struct ABC { int aa, bb, cc; } ABC;
char __xdata buf[100];
void Prob(void)
{
if ( *(char*)&((*(ABC*)buf).cc) ) // no errors or warnings; this changes to __data pointer
Prob();
if ( *(char*)&((*(ABC*)&buf).cc) ) // this messy code may be okay
Prob();
}

>sdcc -v
SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08
3.2.1 #8406 (Jan 31 2013) (MINGW32)

>sdcc --model-large -c -S bug.c

Discussion

  • Maarten Brock

    Maarten Brock - 2013-12-22
    • status: open --> closed-fixed
    • assigned_to: Maarten Brock
    • Category: --> Front-end
     
  • Maarten Brock

    Maarten Brock - 2013-12-22

    Fixed in SDCC 3.3.2 #8921. Code is also optimized now.

     

Log in to post a comment.