views:

75

answers:

1

We recently ran into the following compiler error that repeated at different locations throughout our build:

line-map.c: file "<a source_file name>" left but not entered

The source file was different at different points in the build. After some time, the compiler finally threw the following error:

<header file>: In function `<function name that is not present within the given header file>':
<same header file>:-117020: internal compiler error: in final_scan_insn, at final.c:1790

After a lot of investigation we found that this error was being caused by some #defines in a different header file:

#define GEOGRAPHIC_LOC_TYPE_CGI            0
#define GEOGRAPHIC_LOC_TYPE_SAI            1
#define GEOGRAPHIC_LOC_TYPE_RAI            2
#define GEOGRAPHIC_LOC_TYPE_TAI          128
#define GEOGRAPHIC_LOC_TYPE_ECGI         129
#define GEOGRAPHIC_LOC_TYPE_TAI_AND_ECGI 130

We moved these #defines from the header file in which they currently existed into the .c file, which was the only location in which they were currently being used. Then, we didn't see the compiler error anymore.

Could anyone explain what the above compiler errors mean and why this fix worked?

Thanks, Ryan

+6  A: 

When you get an ICE (Internal Compiler Error), it means the internals of GCC are messed up. Not because of your code, but because of a bug inside GCC code, which is detected by an assert.

The changes in your code that avoid the bug are probably not meaningful.

The next steps are:

  • Update to the latest GCC (4.4.2), to check whether the ICE was fixed.
  • If it wasn't, reduce your code the minimal code producing an ICE
  • Create a Bug Report for that ICE.
Jerome
Sometimes Internal Compiler Errors can be entirely random and in this case the most likely explanation is failing memory chips.
James Morris