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]
Other format: [Raw text]

volatile ptr


Hi,
?
Here is a small piece of code with which I am facing problem. The code has been compiled with O2. I expect both pieces to work identically, but they are not. Could you please explain what's going wrong?? 
?
Code dump with no volatile pointer
?
void MainThread()
{
?? *(UINT4*)(0xe2000a00) = (UINT4) Mainproc;
?? return;
}
?
?
?
00166c00 <MainThread>:
? 166c00:?? 3c020017??? lui v0,0x17
? 166c04:?? 24426400??? addiu?? v0,v0,25600
? 166c08:?? 3c01e200??? lui at,0xe200
? 166c0c:?? 03e00008??? jr? ra
? 166c10:?? ac220a00??? sw? v0,2560(at)
?
Observation: After the function executes, at address 0xe2000a00 we see 0
?
?
code dump with volatile pointer
?
void MainThread()
{
?? *(volatile UINT4*)(0xe2000a00) = (UINT4) Mainproc;
?? return;
}
?
?
00166c00 <MainThread>:
? 166c00:?? 3c03e200??? lui v1,0xe200
? 166c04:?? 3c020017??? lui v0,0x17
? 166c08:?? 34630a00??? ori v1,v1,0xa00
? 166c0c:?? 24426400??? addiu?? v0,v0,25600
? 166c10:?? 03e00008??? jr? ra
? 166c14:?? ac620000??? sw? v0,0(v1)
?
Observation: After the function executes, at address 0xe2000a00 we see 0x176400
?
Thanks,
Sweta
?


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


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