[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2023-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #31 from Andrew Pinski --- For the testcase in comment #0 we do warn: : In function 'void foo()': :7:47: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations] 7 | for (i=0, accum=a[0]; i < N; i++,

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2014-02-16 Thread jackie.rosen at hushmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jackie Rosen jackie.rosen at hushmail dot com changed: What|Removed |Added CC|

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-04-30 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #28 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-30 06:07:23 UTC --- The warning is only printed if the loop has a single exit and known constant iteration count without the undefined behavior analysis, and when the

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-04-30 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #29 from Jakub Jelinek jakub at gcc dot gnu.org 2013-04-30 06:45:54 UTC --- If you want another testcase which doesn't warn and is optimized based on the assumption that undefined behavior doesn't occur, then say:

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-04-29 Thread ppluzhnikov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #27 from Paul Pluzhnikov ppluzhnikov at google dot com 2013-04-29 23:18:29 UTC --- Here is a reduced test case in which g++ (GCC) 4.9.0 20130426 (experimental) produces infinite loop with -O2 due to aggressive loop optimization,

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-14 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #25 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-14 09:13:45 UTC --- Author: jakub Date: Thu Mar 14 09:13:36 2013 New Revision: 196650 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=196650 Log: PR

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-14 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #26 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-14 10:54:45 UTC --- Author: jakub Date: Thu Mar 14 10:54:38 2013 New Revision: 196655 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=196655 Log: PR

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-13 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #29657|0 |1

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-13 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #24 from Richard Biener rguenth at gcc dot gnu.org 2013-03-13 11:00:11 UTC --- (In reply to comment #23) Created attachment 29661 [details] gcc48-pr53265.patch Updated patch as per IRC discussions. Still need to look at

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #29639|0 |1

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #15 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 11:26:15 UTC --- Created attachment 29651 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29651 X2 Incremental debugging hack.

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #16 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 11:30:02 UTC --- First issue is (with -Werror -O2) error on attribs.c. Reduced testcase: const void *a, *b, *c, *d, *e; const void *f[4]; void foo (void) { unsigned long

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #17 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 11:48:09 UTC --- Second issue is from caller-save.c (setup_save_areas), again -Werror -O2: int a, b[53][5], c[53][5]; int bar (void); void foo (void) { int i,

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #18 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 12:35:59 UTC --- There is also a problem in unwind-dw2.c, but that looks like something we should probably fix: ../../../libgcc/unwind-dw2.c: In function

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #19 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 12:40:54 UTC --- On: int a[18]; void foo (void) { int i; for (i = 16; i 32; i++) a[i] = 26; } distilled from unwind-dw2.c, I'm just surprised that at

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #20 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 14:13:56 UTC --- Ok, based on reading what exactly record_estimate does, I've tried: --- tree-ssa-loop-niter.c.xx2013-03-12 13:47:08.0 +0100 +++

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #29650|0 |1

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #22 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-12 21:47:38 UTC --- Short C testcase reproducing the exp_ch7.adb issue (for -O2): void bar (int); __attribute__((noinline)) static int foo (int x) { int i = 1;

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added CC|

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #5 from Richard Biener rguenth at gcc dot gnu.org 2013-03-11 14:14:06 UTC --- The following avoids the miscompile in these obvious cases: Index: gcc/tree-ssa-loop-niter.c

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #6 from Richard Biener rguenth at gcc dot gnu.org 2013-03-11 14:16:20 UTC --- To warn, 1) add a flag to struct loop whether we warned for the loop already 2) in both discover_iteration_bound_by_body_walk and

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #7 from Richard Biener rguenth at gcc dot gnu.org 2013-03-11 14:17:28 UTC --- When warnings are disabled the whole function can be skipped and both estimate and bound be initialized by the result from number_of_latch_executions

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #8 from Jakub Jelinek jakub at gcc dot gnu.org 2013-03-11 15:49:00 UTC --- Created attachment 29637 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29637 gcc48-pr53265.patch Untested patch. Not sure about the warning

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread rguenth at gcc dot gnu.org
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

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread amonakov at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #10 from Alexander Monakov amonakov at gcc dot gnu.org 2013-03-11 16:15:36 UTC --- (In reply to comment #8) Not sure about the warning wording What about (... iteration %E invokes undefined behavior, max)? plus no idea

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Manuel López-Ibáñez manu at gcc dot gnu.org changed: What|Removed |Added CC||manu at gcc

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #12 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-11 16:49:25 UTC --- (In reply to comment #10) (In reply to comment #8) Not sure about the warning wording What about (... iteration %E invokes undefined behavior,

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-03-11 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Attachment #29637|0 |1

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-01-31 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 --- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2013-01-31 12:13:24 UTC --- Another testcase, this time from PR56161 : void bar (void *); void fn6 (void) { double a[4][3], b[12]; int i; bar (b); for (i = 0; i

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2013-01-29 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at

[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count

2012-05-07 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265 Richard Guenther rguenth at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last