0

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.

Jonathan Sterling
  • 18,320
  • 12
  • 67
  • 79
  • Seems like it has been narrowed down further on this question - wonder if they are related: http://stackoverflow.com/questions/5490432/building-with-llvm-and-any-optimization-causes-app-to-crash-on-startup – makdad Apr 04 '11 at 05:01
  • Fascinating. This problem specifically had just decided to start happening; it disappeared when I moved everything to a new project. I, like you, wonder if the two are related. – Jonathan Sterling Apr 04 '11 at 05:04

1 Answers1

3

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
  • 162,346
  • 23
  • 271
  • 359
  • 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 Jul 19 '10 at 04:47
  • 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 Jul 19 '10 at 05:13