Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#653 absolutely-addressed sub-byte structure

closed-rejected
nobody
5
2003-12-01
2003-12-01
Anonymous
No

Absolutely-addressed sub-byte structure generates wrong
code:

Version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic14/pic16/TININative/xa51/ds400/hc08
2.3.6 (Nov 28 2003) (UNIX)

Sample Code:

int main()
{
xdata at 0 struct {
int a : 4;
int b : 4;
} test;

test.a = 1;
test.b = 1;

return 0;
}

this is part of the generated .rst file

144 ;test.c:8:
test.a = 1;
145 ; genAssign
0038 90 00 00 146 mov
dptr,#___00000001
003B 74 01 147 mov a,#0x01
003D F0 148 movx @dptr,a
149 ;test.c:9:
test.b = 1;
150 ; genAssign
003E 90 00 00 151 mov
dptr,#___00000002
0041 74 01 152 mov a,#0x01
0043 F0 153 movx @dptr,a

The compiler makes two assignments into exactly same codes.

When the "at 0" keyword is removed, the generated code
seems good.

Discussion

  • Erik Petrich
    Erik Petrich
    2003-12-01

    • status: open --> closed-rejected
     
  • Erik Petrich
    Erik Petrich
    2003-12-01

    Logged In: YES
    user_id=635249

    This has already been fixed on 26 Nov 2003 in src/SDCCast.c
    1.198