http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53128
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-03 16:02:56 UTC --- (In reply to comment #4) > Isn't it too aggressive from user perspective to perform such transformation > even without warning? Especially for the case when that "wrong" read is not > used later. > Sure it is dangerous anyway to make such access but at he same time it seems > this could affect lot of existing code... Igor, I guess the compiler only sees something like: x = 14 if (x < 13) do_A(); else do_B(); and transform it into: do_A(); It doesn't see that an infinite loop is generated. Now, whether there could be an optimization pass that detects infinite loops, and warns for them, that I am not sure, but surely it would be a nice thing to have. If someone contributed a nice implementation, I think it will be accepted. Unfortunately, I don't think it is in the TODO list of any current contributor.