Re: [patch] Warn on undefined loop exit

2015-02-18 Thread Jakub Jelinek
On Thu, Nov 20, 2014 at 05:27:35PM +0100, Richard Biener wrote: > On Wed, Nov 19, 2014 at 9:19 PM, Andrew Stubbs wrote: > > On 19/11/14 16:39, Marek Polacek wrote: > >> > >> On Wed, Nov 19, 2014 at 04:32:43PM +, Andrew Stubbs wrote: > >>> > >>> +if (warning_at (gimple_locat

Re: [patch] Warn on undefined loop exit

2014-11-21 Thread Andrew Stubbs
On 20/11/14 20:55, Marek Polacek wrote: On Thu, Nov 20, 2014 at 05:27:35PM +0100, Richard Biener wrote: + if (exit_warned && problem_stmts != vNULL) +{ !problem_stmts.empty () /home/marek/src/gcc/gcc/tree-ssa-loop-niter.c: In function ‘void maybe_lower_iteration_bound(loop*)’: /

Re: [patch] Warn on undefined loop exit

2014-11-20 Thread Andrew Stubbs
On 20/11/14 16:27, Richard Biener wrote: If it's really duplicated code can you split it out to a function? + if (OPT_Waggressive_loop_optimizations) +{ this doesn't do what you think it does ;) The variable to check is warn_aggressive_loop_optimizations. + if (exit_warned && pr

Re: [patch] Warn on undefined loop exit

2014-11-20 Thread Marek Polacek
On Thu, Nov 20, 2014 at 05:27:35PM +0100, Richard Biener wrote: > + if (exit_warned && problem_stmts != vNULL) > +{ > > !problem_stmts.empty () /home/marek/src/gcc/gcc/tree-ssa-loop-niter.c: In function ‘void maybe_lower_iteration_bound(loop*)’: /home/marek/src/gcc/gcc/tree-ssa-loop

Re: [patch] Warn on undefined loop exit

2014-11-20 Thread Richard Biener
On Wed, Nov 19, 2014 at 9:19 PM, Andrew Stubbs wrote: > On 19/11/14 16:39, Marek Polacek wrote: >> >> On Wed, Nov 19, 2014 at 04:32:43PM +, Andrew Stubbs wrote: >>> >>> +if (warning_at (gimple_location (elt->stmt), >>> +OPT_Waggressive_lo

Re: [patch] Warn on undefined loop exit

2014-11-19 Thread Andrew Stubbs
On 19/11/14 16:39, Marek Polacek wrote: On Wed, Nov 19, 2014 at 04:32:43PM +, Andrew Stubbs wrote: +if (warning_at (gimple_location (elt->stmt), +OPT_Waggressive_loop_optimizations, +"Loop exit may on

Re: [patch] Warn on undefined loop exit

2014-11-19 Thread Marek Polacek
On Wed, Nov 19, 2014 at 04:32:43PM +, Andrew Stubbs wrote: > + if (warning_at (gimple_location (elt->stmt), > + OPT_Waggressive_loop_optimizations, > + "Loop exit may only be reached after > undefined behaviour.

Re: [patch] Warn on undefined loop exit

2014-11-19 Thread Andrew Stubbs
On 13/11/14 21:35, Andrew Stubbs wrote: On 12/11/14 11:15, Richard Biener wrote: Please find a better way to communicate possibly_undefined_stmt than enlarging struct loop. Like associating it with the niter bound we record (so you can also have more than one). Unfortunately, the bounds get r

Re: [patch] Warn on undefined loop exit

2014-11-13 Thread Andrew Stubbs
On 12/11/14 11:15, Richard Biener wrote: Please find a better way to communicate possibly_undefined_stmt than enlarging struct loop. Like associating it with the niter bound we record (so you can also have more than one). Unfortunately, the bounds get regenerated frequently, but the upper bou

Re: [patch] Warn on undefined loop exit

2014-11-12 Thread Richard Biener
On Wed, Nov 5, 2014 at 10:45 PM, Andrew Stubbs wrote: > This patch adds the following warning message: > > undefined.c:9:20: warning: statement may be undefined in the final loop > iteration. [-Waggressive-loop-optimizations] >for (i = 0; array[i] && i < 5; i++) > ^ > > (Wh

Re: [patch] Warn on undefined loop exit

2014-11-12 Thread Andrew Stubbs
Ping. On 05/11/14 21:45, Andrew Stubbs wrote: This patch adds the following warning message: undefined.c:9:20: warning: statement may be undefined in the final loop iteration. [-Waggressive-loop-optimizations] for (i = 0; array[i] && i < 5; i++) ^ (Where the code ought

[patch] Warn on undefined loop exit

2014-11-05 Thread Andrew Stubbs
This patch adds the following warning message: undefined.c:9:20: warning: statement may be undefined in the final loop iteration. [-Waggressive-loop-optimizations] for (i = 0; array[i] && i < 5; i++) ^ (Where the code ought to read "i < 5 && array[i]".) The tree-ssa loo