c++ - Android ndk-r9 compiler optimization issues -
i switched using android ndk-r9 , having difficulty app seems related compiler optimization. have following function:
int gettouchpos(gtouchevents * pevents, gpointf * ppos, int * pbutton = 0) { int count = 0; gtouchevent * pevent; if (pevents->getcount(&count) == gresult_ok) { gdebuglog((gs("gettouchpos: count = %d"), count)); if (pevents->getevent(0, &pevent) == gresult_ok) { pevent->gettappos(ppos); if (pbutton) { pevent->getbutton(pbutton); } pevent->release(); } } return(count); }
if build project , run it, call gdebuglog formats , logs value of variable 'count'. when this, 'count' 1 , app works correctly. if comment out gdebuglog line (and make no other changes), when run app, no longer works. in function gtouchevents::getcount, logging returning , value correctly '1'. also, log return call function above (i.e. gettouchpos). when gdebuglog line present, logged return value correct value '1'. when comment out gdebuglog call, logged return value seemingly random number, looks suspiciously uninitialized variable.
note works our without gdebuglog line when using r8b. note if turn optimization off, code works using r9 whether debugging line present or not. note behavior presents when compiling arm processor. version build x86 works without problem.
am doing questionable here causing optimizer generate incorrect code?
can shed light on might happening?
thanks.
Comments
Post a Comment