Fix crash du to opt that introduce cycle in the graph

NEWS.txt
Fix crash caused by an optimization that introduce cycle in the graph (Frederic Bastien, reported by Axel Davy)