iPhone and Thumb stuff

BigZaphod
Posts: 7
Joined: Wed Mar 25, 2009 5:31 pm

Re: iPhone and Thumb stuff

Post by BigZaphod »

gleemer wrote:I found this on the box2d board:

Porting to iphone myself.

O3 is definately the fastest, along with disabled thumb. The problem here is, with O3 you need to always initialize your variables fully.

This is because the fastest, smallest flag actually uses a local stack, and doesn't assume that new variables will be null.

By making sure all variables are nulled to begin with, you will avoid bugs with O3. Its all about making sure that new vars are not pointing to some garbage, but to null. If you make it null, it will work fine.

I think Box2D is a little lazy in places and doesn't always initialise variables with null or a value and this is why it breaks. I pulled this info off Apple site someplace, can't remember where.
I ran across this comment as well, so I turned on all warnings and tried to fix everything in Bullet that caused a warning - especially the uninitialized variables. Unfortunately it didn't appear to fix anything. :/
BigZaphod
Posts: 7
Joined: Wed Mar 25, 2009 5:31 pm

Re: iPhone and Thumb stuff

Post by BigZaphod »

After significant trial and error, I determined that adding the following GCC flag gets rid of the problem:

-fno-regmove

I can now compile with -O3 as long as I also disable that particular optimization and everything appears to work as expected. Anyone have any idea what kind of code would cause that optimization to fail or are we maybe seeing a bug in the compiler?

EDIT: I submitted this to Apple, but since I can't figure out a good way to narrow down where, exactly, the code goes wrong, I had to attach my entire project. I don't know if that'll help them or not, but at this point it feels an awful lot like a compiler bug.
martaaay
Posts: 2
Joined: Tue Apr 14, 2009 9:26 pm

Re: iPhone and Thumb stuff

Post by martaaay »

I ran into a compiler bug that may be a dup of this bug. I fixed it by "outlining" my code (i.e., pull the offending code into a function and call it). I'm guessing there's some form of scheduling bug in -O2. I'll have to try the -fno-regmove toy.
Pilo
Posts: 5
Joined: Sat Jan 10, 2009 11:10 am

Re: iPhone and Thumb stuff

Post by Pilo »

Hi!

I tried the trick with -fno-regmove flag, and it now compiles and run fine with -O3 option.

Thanks for it ;)
biino
Posts: 1
Joined: Mon Oct 12, 2009 10:41 am

Re: iPhone and Thumb stuff

Post by biino »

Hi,

I've just encountered this issue with the latest version (2.75) on the Iphone\Ipod Touch. The suggested compiler settings worked.

Erwin: I'm happy to help nut down why this is occuring. I can provide my solution or try the things requested if you'd like help with this.

My project uses Irrlicht and Bullet. I haven't noticed any weird issues with Irrlicht, so it could be something with Bullet?

Bino
Post Reply