So I have a project that I have been compiling on the apple-darwin11-llvm-g++-4.2 compiler. The project will compile with GCC 4.4.5 on RedHat linux but there are some very strange things going on in the runtime. There are no runtime errors, but the program output is completely different.
I am pretty terrible with GDB so I am and I need to submit this project by midnight tonight for school. Could anyone possibly suggest some things that come to mind that might be causing this? Maybe some known differences between these two compilers that could give me somewhere to look?
I realize this is very vague, I am trying to learn to use gdb so I can figure out what is happening.
To solve this problem I went through the checklist suggested by @AdrianCornish :
“If the program output is not the same then it is very likely that you are misusing the language and are causing undefined behavior. It is very unlikely that it is a difference in the compilers. Have you initialized all variables before use? Are you allocating and using memory correctly within bounds. Are variables in function initialized to default values?” – Adrian Cornish
Through this I discovered that there was an integer variable which I had forgotten to initialize to zero in my constructor. Apparently the llvm will automatically initialize variables to zero, while gcc does not.