This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

struct member variable indexing problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]