Both as C and C++ the code returned a warning for me.
Using Apple's GCC 3.3 20030304 Build 1495.
gcc -c bug.c
g++ -c bug.cpp
>Is there a known bug in the above compiler that caused this?
Would you retry compiling your code snippet. Since it generated a warning for me, I'm surprised / concerned.
>Or could there be some other problem that causes the compiler to behave like this?
Do you have warnings suppressed? What was your command line?
>Could it be that the compiler optimised away some code and over looked this error?
No.
>Is there any compiler options that could enforce this error checking?
g++ -pedantic -Werror -Wall -W -c bug.cpp
>One last unrelated question, can I use the true gcc compiler (not apple's customised version) on a mac?
Do you merely want to run your code at the Darwin level? Then yes.
HTH, --Eljay