Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 381
WolfgangP Avatar asked Jul 03 '10 00:07

WolfgangP


2 Answers

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

like image 200
Clark Gaebel Avatar answered Oct 10 '22 06:10

Clark Gaebel


and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor and xor_eq are keywords which are enabled with -ansi or -foperator-names

you have one of those switches enabled?

check also out: this

like image 23
AndersK Avatar answered Oct 10 '22 08:10

AndersK