http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265



--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-11 
15:58:41 UTC ---

(In reply to comment #8)

> Created attachment 29637 [details]

> gcc48-pr53265.patch

> 

> Untested patch.  Not sure about the warning wording, plus no idea how to call

> the warning option (-Wnum-loop-iterations, -Wundefined-behavior-in-loop,

> something else?), whether to enable it by default, or just for -Wall.

> A bigger issue is that I see multiple warnings for the same stmts, despite the

> guard in loop structure, because apparently the same loop is represented by

> different loop structures during the optimizations.



Yeah, before the tree loop optimization pipeline loops are not preserved ...

(easy to change, apart from code missing to inline a loop tree).



Eventually use gimple_no_warning on the stmt?  Supposedly not very reliable

either.



I think with your patch you also fail to warn for bounds discovered by

discover_iteration_bound_by_body_walk or maybe_lower_iteration_bound.

That said, I'd expected you warn from within record_niter_bound.  Btw,

after number_of_latch_executions () its return value is cached in

loop->nb_iterations, no need to pass around another value.

Reply via email to