Search code examples
macosgcc

Variable name 'xor' results in internal compiler error 'segmentation fault'!


Compiling this code

int main(int argc, char **argv)
{
    int xor = 0;
}

via

g++ main.cpp 

results in:

internal compiler error: Segmentation fault

with

i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659).

Renaming the variable removes the error.

Question: Is gcc from Apple crap?


Solution

  • Any time your compiler segfaults, it's a bug. Your already reduced test case is a perfect candidate to be reported to GCC.