Compiling can be magic somehow. Especially if you try to reconstruct strange behaviour of a special binary. The interesting question in that case is, which gcc version was used for a particiular binary.
As GCC writes its version information, we can find it out with a simple command chain:
strings -a /path/to/binary-file | grep “GCC:” | sort -u