3

When I am trying to test my application on device with default compiler setting, LLVM GCC 4.2, its giving me "Internal compiler error: Bus error", but it is working OK with GCC 4.2 and LLVM compiler 2.0.

What can be the possible reason/reasons for this error? Is it possible to distribute your application with GCC 4.2?

itsaboutcode
  • 24,525
  • 45
  • 110
  • 156
  • Any reason why you are not using clang? – Šimon Tóth Jun 06 '11 at 09:33
  • @Let_Me_Be - sorry, don't know anything about clang with reference to this problem. – itsaboutcode Jun 06 '11 at 09:35
  • @itsaboutcode Well, clang is a compiler frontend, it is using LLVM as backend. It is a much cleaner combination then LLVM GCC. Try clang and see if the problem persists. – Šimon Tóth Jun 06 '11 at 09:38
  • @Let_Me_Be - In iphone, I have only 3 options - LLVM GCC 4.2, GCC 4.2 and LLVM compiler 2.0. – itsaboutcode Jun 06 '11 at 09:45
  • @itsaboutcode Oh, ok, then I guess LLVM compiler 2.0 is clang, since LLVM can't compile C by itself, it needs a front-end. OK, so what's wrong with using the LLVM compiler 2.0 option? – Šimon Tóth Jun 06 '11 at 10:03
  • @Let_Me_Be - I am not getting any error in this case. But question is, why it is giving me error in default option? – itsaboutcode Jun 06 '11 at 10:47
  • @itsaboutcode Compilers, as any software, do have bugs. I wouldn't give much thought into it. You can try to isolate the code, that is causing the problem and report the issue. – Šimon Tóth Jun 06 '11 at 10:50
  • 2
    I'm having the same problem too, and actually your post kind of solved it -- switching to GCC 4.2 did the trick. I don't know why it failed in the first place (LLVM 2.0 wouldn't work because I am using the TVOutManager library that throws a warning). I also wanted to add that my code compiles fine in the simulator too, regardless of the compiler setting. – Mirkules Jun 29 '11 at 20:29

1 Answers1

0

"Bus error" usually means that your application is trying to perform an unaligned memory access, which is not allowed by default.

You can try either tell gcc to generate only aligned memory accesses or set the unaligned memory access handling in the OS kernel (not sure whether it's possible in iOS):

echo 2 > /proc/cpu/alignment
Cyrille
  • 25,014
  • 12
  • 67
  • 90
kayrick
  • 187
  • 4
  • That's feasible in Linux, but not in OSX / iOS. There's no `/proc` tree on these systems. And `gcc` is no longer the default compiler on iOS, it's `llvm`. – Cyrille Oct 06 '12 at 08:06