http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59475
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Akela1101 from comment #3) > Thank you. > But could you explain in more detail, why results of this little program are > different depending on -O1 flag? I thought they both should be 0. Or am I > wrong? Because of optimization. At -O1, the compiler inlines the function ignoring the one in the other TU. At -O0, the compiler emits both functions and the linker randomly chooses which one to use.