Compiling with LLVM/Clang causes crash, not GCC 4.2

筅森魡賤 提交于 2019-12-25 04:53:28

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3278337/compiling-with-llvm-clang-causes-crash-not-gcc-4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!