Can compiler optimization introduce bugs ?
- by ereOn
Hi,
Today I had a discussion with a friend of mine and we debated for a couple of hours about "compiler optimization".
I defended the point that sometimes, a compiler optimization might introduce bugs or at least, undesired behavior.
My friend totally disagreed, saying that "compiler are built by smart people and do smart things" and thus, can never go wrong.
He didn't convinced my at all, but I have to admit I lack of real-life examples to strengthen my point.
Who is right here ? If I am, do you have any real-life example where a compiler optimization produced a bug in the resulting software ? If I'm mistaking, should I stop programming and learn fishing instead ?
Thank you !