Hi all,
I am able to run code in optimization level - O0 in DS-5 and outputs also matched with reference outputs, but the same code is not working in other optimization levels - O1, O2 and O3 in DS-5, it is simply exiting from program.
typedef short Word16;
typedef struct student
{
Word16 x; Word16 y;
}stu;
void inputs_read( stu *st_fx)
st_fx->x= 0;
st_fx->y= -1;
}
This code is not working in DS-5. when i am trying to run, at this point program execution stopped in DS-5.
I tried debugging the code in -O1, -O2 ,I found it is not able to find some structure variables with data type short int , other variables from the same structure with same data types are working fine. I didn't understand the reason.
I added a printf() statement in between these two structure variables , with this code is working fine. But i am not getting whether the issue is related to structure variables or alignment or with other.
printf("%d\n", st_fx->x);
with this printf() statement code is working fine.
Can anyone please guide me on this. I blocked at this point, please help me on this.
Thanks in advance,
Divya.
I don't think you have quite understood what I am saying. I believe when the code is optimized it is inlined in the place it is called from. The compiler is turning the function into code it places within the calling routine and optimized the whole calling routine with that code inserted into it rather than calling this function. I can't tell anything about the bug otherwise, it may for instance have nothing to do with that structure and be because of a problem with other statements before or after the call to this routine. If you could produce a small program out of the calling routine together with this it may exhibit the bug without showing much about whatever else you are doing and then that could be used in a bug report to ARM.