Can compiler optimization introduce bugs ?

Posted by ereOn on Stack Overflow See other posts from Stack Overflow or by ereOn
Published on 2010-04-27T15:01:33Z Indexed on 2010/04/27 15:03 UTC
Read the original article Hit count: 459

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 !

© Stack Overflow or respective owner

Related posts about compiler

Related posts about optimization