使用LLVM/Clang编译会导致崩溃,而不是GCC 4.2 [英] Compiling with LLVM/Clang causes crash, not GCC 4.2

查看:205
本文介绍了使用LLVM/Clang编译会导致崩溃,而不是GCC 4.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发iPhone应用程序,但遇到了一些编译器问题.这是低点:

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

  1. 我正在使用针对iOS 4.0的Xcode 3.2.3进行编译:我的设备是运行iOS 4.0的第二代iPod touch.
  2. 使用GCC 4.2进行编译:可同时在模拟器和设备上运行
  3. 使用LLVM编译器1.5进行编译:可在模拟器上使用,但不能在设备上使用.
  4. 使用LLVM GCC 4.2进行编译:与LLVM编译器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.

我不知道这是怎么回事.我真的很想更新代码,以使用WWDC上宣布的最新功能(隐式@synthesize,在类别中添加实例变量的功能等),但是Clang是必需的.

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.

推荐答案

看起来像是内存中积蓄的东西.更具体地说,在堆栈上.

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

在LLVM和GCC之间,在代码生成方面存在一些相当显着的(尽管非常微妙的)差异.请记住,LLVM-GCC实际上是GCC-> LLVM;也就是说,GCC解析器为LLVM代码生成引擎提供了动力.

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.

因此,我怀疑您遇到了一个非常可爱的案件. LLVM的代码源中的错误或程序中表现为这种崩溃的错误.

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.

这篇关于使用LLVM/Clang编译会导致崩溃,而不是GCC 4.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆