XCode 4.2 clang seg fault

亡梦爱人 提交于 2020-02-03 09:06:09

问题


Just upgraded to Lion and xcode 4.2. Now when I recompile my program I getting these errors:

  1. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1806:35: current parser token ';'
  2. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: parsing Objective-C method 'updateWithTouchLocationMoved:withEvent:view:'
  3. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1762:1: in compound statement ('{}')
  4. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1771:2: in compound statement ('{}')
  5. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1789:3: in compound statement ('{}')
  6. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1796:4: in compound statement ('{}')
  7. /Users/XXX/Code/iPhone/XXX/Code/Scenes/GameScene.mm:1799:5: in compound statement ('{}')
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)

There is nothing odd going on around those line numbers. No compound statements, just simple if (a == b) type stuff. Some of the error line numbers aren't even on statements, just blank lines or a { brace. I suspect that the line numbers are not accurate. I'm kind of dead in the water now. Code compiled fine under 4.1.

Any advice?


回答1:


I stopped the compiler from crashing. After commenting out line after line of code to see where this was actually happening I arrived at this line:

shape.shapeType |= kTypeBreakable;

Doing...

shape.shapeType = shape.shapeType | kTypeBreakable;

...compiles fine. So does...

shape.shapeType |= 0x00000200;

kTypeBreakable is an enum that is set to 0x00000200

shapeType is just a obj-c object variable with a getter/setting.

Very very odd compiler bug.



来源:https://stackoverflow.com/questions/7762283/xcode-4-2-clang-seg-fault

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