views:

142

answers:

1

I'm working on an iPhone app, and I'm having some compiler trouble. Here's the low-down:

  1. I am compiling using Xcode 3.2.3, targeting iOS 4.0: my device is a 2nd Gen. iPod touch running iOS 4.0.
  2. Compiling with GCC 4.2: works on both the simulator and the device
  3. Compiling with LLVM compiler 1.5: works on simulator, but not on device.
  4. Compiling with LLVM GCC 4.2: same problem as with LLVM compiler 1.5.

When it fails, the app never even finishes loading. This is what the log looks like:

run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
sharedlibrary apply-load-rules all
continue
Program received signal:  “EXC_BAD_ACCESS”.
warning: check_safe_call: could not restore current frame

warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.

I have no idea what is going on with this. I really want to update my code to use the latest features announced at WWDC (implicit @synthesize, the ability to add instance variables in categories, etc.), but Clang is necessary for that.

+3  A: 

Looks like something pooped on memory. More specifically, on the stack.

There are some fairly significant, though entirely subtle, differences in code-gen between LLVM and GCC. Keep in mind that LLVM-GCC is really GCC->LLVM; that is, the GCC parser feeding the LLVM code generation engine.

Thus, I suspect you have hit a lovely edge case. Either a bug in LLVM's codegen or a bug in your program that manifests itself as this kind of a crash.

Off the top of my head, I could imagine that a failure to -copy a block and then execute that block on a different thread might manifest as a crash like this.

In any case, file a bug if you can.

bbum
Thanks for the analysis. The problem is that none of my code is actually being run, so I don't think it can be a problem there. It doesn't even make it to -applicationDidFinishLaunching:.Is it possible that I just borked my devtools installation somehow?
Jonathan Sterling
Could be. That sounds like a dyld/linker issue. A re-install can't hurt. Very strange. Still; file a bug and provide the binary, if possible.
bbum