struct member variable indexing problem

jw c info2choijo@yahoo.com
Thu Mar 15 21:08:00 GMT 2001


Hello. 
I'm using gcc newly ported to new mcu called se3208. 
When I compile the following code with -O2 option, 

typedef struct{
long a;
short b;
short c;
long d;
} STRUCT;

STRUCT aVar;

int main(){
aVar.c=0xcccc;
aVar.d=0xdddddddd;
}

The compiler makes assembly code as following. 
Here, %r1 is pointing aVar.c. 
...
sts %r0, (%r1,0)
st %r0, (%r1,2)
...

But assembler assemble the code just as the next
lines. 
...
sts %r0, (%r1,0)
st %r0, (%r1,0)
...
So this is a problem. 


I want the assembly code to be made like the next
lines. 
...
sts %r0, (%r1,-2)
st %r0, (%r1,0)
...
Here %r0 should point aVar.d. How can I do this?
I'll appreciate any comment or pointer. 

Jang-Wook


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list