* [Bug c/66422] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
@ 2015-06-04 22:16 ` gajjanagadde at gmail dot com
2015-06-05 3:47 ` gajjanagadde at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gajjanagadde at gmail dot com @ 2015-06-04 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
--- Comment #2 from Ganesh Ajjanagadde <gajjanagadde at gmail dot com> ---
But myfoo->foo_size is not set within the foo_loop function.
For instance, myfoo->foo_size could be set outside the function boundary,
and then the function could be called (say foo_size = 3 or 4).
This is represented by the get_foo() function.
Then, as long as the programmer guarantees that when this function is called,
myfoo->foo_size is always <= 4, there is certainly no error.
Furthermore, note that I put a < 3 condition as opposed to a <= 3.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/66422] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
2015-06-04 22:16 ` [Bug c/66422] " gajjanagadde at gmail dot com
@ 2015-06-05 3:47 ` gajjanagadde at gmail dot com
2015-06-05 3:50 ` gajjanagadde at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gajjanagadde at gmail dot com @ 2015-06-05 3:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
Ganesh Ajjanagadde <gajjanagadde at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #35698|0 |1
is obsolete| |
--- Comment #3 from Ganesh Ajjanagadde <gajjanagadde at gmail dot com> ---
Created attachment 35699
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35699&action=edit
testv2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/66422] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
2015-06-04 22:16 ` [Bug c/66422] " gajjanagadde at gmail dot com
2015-06-05 3:47 ` gajjanagadde at gmail dot com
@ 2015-06-05 3:50 ` gajjanagadde at gmail dot com
2015-06-08 10:37 ` [Bug tree-optimization/66422] " rguenth at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gajjanagadde at gmail dot com @ 2015-06-05 3:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
--- Comment #4 from Ganesh Ajjanagadde <gajjanagadde at gmail dot com> ---
Updated attachment that compiles to standalone executable (invoked with similar
flags for with/without warning as before: gcc -Warray-bounds -O3 test.c,
gcc -Warray-bounds test.c respectively).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (2 preceding siblings ...)
2015-06-05 3:50 ` gajjanagadde at gmail dot com
@ 2015-06-08 10:37 ` rguenth at gcc dot gnu.org
2015-06-08 10:41 ` [Bug tree-optimization/66422] [5/6 Regression] " rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-08 10:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-06-08
CC| |hubicka at gcc dot gnu.org
Component|c |tree-optimization
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, so we peeled the loop like
run_foo ()
{
...
<bb 10>:
_33 = myfoo_28->buf[3];
if (_33 != 1)
goto <bb 13>;
else
goto <bb 11>;
<bb 11>:
_34 = (int) _27;
if (_34 > 4)
goto <bb 12>;
else
goto <bb 13>;
<bb 12>:
__builtin_unreachable ();
_35 = myfoo_28->buf[4];
<bb 13>:
# _36 = PHI <0(2), 1(3), 0(4), 1(5), 0(6), 1(7), 0(8), 1(9), 0(10), 1(11),
0(12)>
if (_36 != 0)
goto <bb 15>;
else
goto <bb 14>;
<bb 14>:
i_37 = 1;
<bb 15>:
# _2 = PHI <0(13), -1(14)>
return _2;
and the unreachable () remains in the CFG.
Honza - it seems that remove_exits_and_undefined_stmts inserts these
unreachable calls but fails to split the BBs.
I have a patch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5/6 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (3 preceding siblings ...)
2015-06-08 10:37 ` [Bug tree-optimization/66422] " rguenth at gcc dot gnu.org
@ 2015-06-08 10:41 ` rguenth at gcc dot gnu.org
2015-06-08 14:53 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-08 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.9.2
Target Milestone|--- |5.2
Summary|-Warray-bounds false |[5/6 Regression]
|positive with -O3 |-Warray-bounds false
| |positive with -O3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5/6 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (4 preceding siblings ...)
2015-06-08 10:41 ` [Bug tree-optimization/66422] [5/6 Regression] " rguenth at gcc dot gnu.org
@ 2015-06-08 14:53 ` rguenth at gcc dot gnu.org
2015-06-09 8:25 ` [Bug tree-optimization/66422] [5 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-08 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jun 8 14:53:19 2015
New Revision: 224235
URL: https://gcc.gnu.org/viewcvs?rev=224235&root=gcc&view=rev
Log:
2015-06-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/66422
* tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Split
block after inserted gcc_unreachable.
* gcc.dg/Warray-bounds-16.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/Warray-bounds-16.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-loop-ivcanon.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (5 preceding siblings ...)
2015-06-08 14:53 ` rguenth at gcc dot gnu.org
@ 2015-06-09 8:25 ` rguenth at gcc dot gnu.org
2015-06-11 22:01 ` hubicka at ucw dot cz
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-09 8:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |6.0
Summary|[5/6 Regression] |[5 Regression]
|-Warray-bounds false |-Warray-bounds false
|positive with -O3 |positive with -O3
Known to fail| |5.1.0
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (6 preceding siblings ...)
2015-06-09 8:25 ` [Bug tree-optimization/66422] [5 " rguenth at gcc dot gnu.org
@ 2015-06-11 22:01 ` hubicka at ucw dot cz
2015-06-22 14:12 ` rguenth at gcc dot gnu.org
2015-06-22 14:13 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: hubicka at ucw dot cz @ 2015-06-11 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
--- Comment #8 from Jan Hubicka <hubicka at ucw dot cz> ---
>
> run_foo ()
> {
> ...
> <bb 10>:
> _33 = myfoo_28->buf[3];
> if (_33 != 1)
> goto <bb 13>;
> else
> goto <bb 11>;
>
> <bb 11>:
> _34 = (int) _27;
> if (_34 > 4)
> goto <bb 12>;
> else
> goto <bb 13>;
>
> <bb 12>:
> __builtin_unreachable ();
> _35 = myfoo_28->buf[4];
>
> <bb 13>:
> # _36 = PHI <0(2), 1(3), 0(4), 1(5), 0(6), 1(7), 0(8), 1(9), 0(10), 1(11),
> 0(12)>
> if (_36 != 0)
> goto <bb 15>;
> else
> goto <bb 14>;
>
> <bb 14>:
> i_37 = 1;
>
> <bb 15>:
> # _2 = PHI <0(13), -1(14)>
> return _2;
>
> and the unreachable () remains in the CFG.
>
> Honza - it seems that remove_exits_and_undefined_stmts inserts these
> unreachable calls but fails to split the BBs.
>
> I have a patch.
Hmm, Indeed. I have expected cleanup_cfg to get rid of _35 = myfoo_28->buf[4];.
I suppose this changed with your compile time work for GCC 5?
Honza
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (7 preceding siblings ...)
2015-06-11 22:01 ` hubicka at ucw dot cz
@ 2015-06-22 14:12 ` rguenth at gcc dot gnu.org
2015-06-22 14:13 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-22 14:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/66422] [5 Regression] -Warray-bounds false positive with -O3
2015-06-04 21:53 [Bug c/66422] New: -Warray-bounds false positive with -O3 gajjanagadde at gmail dot com
` (8 preceding siblings ...)
2015-06-22 14:12 ` rguenth at gcc dot gnu.org
@ 2015-06-22 14:13 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-22 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66422
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jun 22 14:12:24 2015
New Revision: 224732
URL: https://gcc.gnu.org/viewcvs?rev=224732&root=gcc&view=rev
Log:
2015-06-22 Richard Biener <rguenther@suse.de>
Backport from mainline
2015-06-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/66422
* tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Split
block after inserted gcc_unreachable.
* gcc.dg/Warray-bounds-16.c: New testcase.
Added:
branches/gcc-5-branch/gcc/testsuite/gcc.dg/Warray-bounds-16.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/testsuite/ChangeLog
branches/gcc-5-branch/gcc/tree-ssa-loop-ivcanon.c
^ permalink raw reply [flat|nested] 11+ messages in thread