Xcode 4.0.1 has started giving me an internal compiler error. It just says "Bus error". It occurs at the bottom of one of my .m files, which is now almost 4000 lines long.
I've looked at this question, but I'm not making that mistake, and when it comes up I can usually fix it by adding some random lines of code somewhere. When it first cropped up, I tracked it down to where I was setting the frame of a view in a bunch of new code:
view.frame = CGRectMake(otherView.frame.origin.x, 0, otherView2.frame.size.width, 40);
If I replaced the otherView and otherView2 references with hardcoded values, the problem went away. Or if I simply put int x = 0;
above the offending line, it went away.
I've also looked at this question, but it doesn't have a clear answer. It doesn't seem to be any individual line of code; it just comes up seemingly randomly. And Google doesn't have any clear solution that I could find.
I've tried with all the possible compilers for the project (GCC 4.2, LLVM GCC 4.2, and LLVM Compiler 2.0, and they all have the problem. I have the Static Analyzer set to run every build, and turning it off doesn't help. This question seems to indicate it's a bug in the compiler. Am I just stuck? Is there a workaround?
EDIT: Another example: It happened again and I tracked it down to:
[headerView centerViewVertically:milesLabel pixelsFromRight:pointLabel.frame.size.width + 20];
I changed it to:
int x = pointLabel.frame.size.width;
[headerView centerViewVertically:milesLabel pixelsFromRight:x + 20];
And it worked again.