public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/53265] New: Warn when undefined behavior implies smaller iteration count
@ 2012-05-07 14:09 amonakov at gcc dot gnu.org
  2012-05-07 14:21 ` [Bug tree-optimization/53265] " rguenth at gcc dot gnu.org
                   ` (30 more replies)
  0 siblings, 31 replies; 32+ messages in thread
From: amonakov at gcc dot gnu.org @ 2012-05-07 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53265
           Summary: Warn when undefined behavior implies smaller iteration
                    count
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amonakov@gcc.gnu.org


As requested in PR 53128, this is an enhancement request that asks to produce a
warning when loop bound inferred from undefined behavior may be used to
transform the loop in a surprising way.

Example code:

enum {N=4};
int a[N], pfx[N];
void foo()
{
  int i, accum;
  for (i=0, accum=a[0]; i < N; i++, accum+=a[i])
    pfx[i] = accum;
}

VRP in trunk produces an infinite loop from the above. By the way, with
-fno-tree-vrp one would expect that cunroll unrolls just 3 iterations of the
loop, but in fact it unrolls 4, because nb_iterations is not updated when
nb_iterations_upper_bound is reduced from UB analysis.

Can we simply warn when UB analysis reduces nb_iterations_upper_bound and makes
it statically smaller than symbolic nb_iterations?


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2023-06-09 16:52 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07 14:09 [Bug tree-optimization/53265] New: Warn when undefined behavior implies smaller iteration count amonakov at gcc dot gnu.org
2012-05-07 14:21 ` [Bug tree-optimization/53265] " rguenth at gcc dot gnu.org
2013-01-29 17:23 ` jakub at gcc dot gnu.org
2013-01-31 12:13 ` jakub at gcc dot gnu.org
2013-03-11 10:15 ` rguenth at gcc dot gnu.org
2013-03-11 14:14 ` rguenth at gcc dot gnu.org
2013-03-11 14:16 ` rguenth at gcc dot gnu.org
2013-03-11 14:17 ` rguenth at gcc dot gnu.org
2013-03-11 15:49 ` jakub at gcc dot gnu.org
2013-03-11 15:59 ` rguenth at gcc dot gnu.org
2013-03-11 16:16 ` amonakov at gcc dot gnu.org
2013-03-11 16:42 ` manu at gcc dot gnu.org
2013-03-11 16:50 ` manu at gcc dot gnu.org
2013-03-11 17:11 ` jakub at gcc dot gnu.org
2013-03-12 11:25 ` jakub at gcc dot gnu.org
2013-03-12 11:26 ` jakub at gcc dot gnu.org
2013-03-12 11:30 ` jakub at gcc dot gnu.org
2013-03-12 11:48 ` jakub at gcc dot gnu.org
2013-03-12 12:37 ` jakub at gcc dot gnu.org
2013-03-12 12:41 ` jakub at gcc dot gnu.org
2013-03-12 14:15 ` jakub at gcc dot gnu.org
2013-03-12 20:10 ` jakub at gcc dot gnu.org
2013-03-12 21:48 ` jakub at gcc dot gnu.org
2013-03-13 10:36 ` jakub at gcc dot gnu.org
2013-03-13 11:01 ` rguenth at gcc dot gnu.org
2013-03-14  9:14 ` jakub at gcc dot gnu.org
2013-03-14 10:55 ` jakub at gcc dot gnu.org
2013-04-29 23:18 ` ppluzhnikov at google dot com
2013-04-30  6:07 ` jakub at gcc dot gnu.org
2013-04-30  6:46 ` jakub at gcc dot gnu.org
2014-02-16 13:14 ` jackie.rosen at hushmail dot com
2023-06-09 16:52 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).