public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
[not found] <bug-25643-4@http.gcc.gnu.org/bugzilla/>
@ 2012-06-29 13:23 ` rguenth at gcc dot gnu.org
2023-09-03 3:24 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-29 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW
--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-29 13:23:15 UTC ---
(In reply to comment #5)
> Grrr:
> Visiting PHI node: i_3 = PHI <i_17(4), i_13(13)>;
> Argument #0 (4 -> 12 executable)
> i_17
> Value: [1, 1] EQUIVALENCES: { } (0 elements)
>
> Argument #1 (13 -> 12 executable)
> i_13
> Value: [2, +INF] EQUIVALENCES: { } (0 elements)
>
> so we have [1,1] UNION [2, +INF] and we just get ~[0,0] bogus
> and it also means this is PR 23744.
This is now fixed but the rest still applies.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
[not found] <bug-25643-4@http.gcc.gnu.org/bugzilla/>
2012-06-29 13:23 ` [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran rguenth at gcc dot gnu.org
@ 2023-09-03 3:24 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-03 3:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference now is:
```
void f0(int n, float *v)
{
int i;
if (n <= 0)
return;
else
{
i = 1;
do {
if (i > n) __builtin_abort ();
v[i] = 0.0;
i++;
} while (i != n);
}
}
void f1(int n, float *v)
{
int i;
if (n <= 0)
return;
else
{
i = 1;
do {
if (i > n) __builtin_abort ();
v[i] = 0.0;
i++;
} while (i <= n);
}
}
```
Dom2 can remove the if for f1 while not for f0 due to the relationship in the
f0 is `!=` and `>` while in the second case it is `<=`/`>` for both.
Also the original fortran testcase still does not optimize either for LP64
targets. where fortran uses basically long to do the math
something like:
```
float v[1000];
void f1(int n)
{
int i;
if (n <= 0)
return;
else
{
i = 1;
do {
long t = i;
if (t > (long)n) __builtin_abort ();
v[i] = 0.0;
t++;
i = t;
} while (i <= n);
}
}
```
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (12 preceding siblings ...)
2008-01-12 15:15 ` rguenth at gcc dot gnu dot org
@ 2008-03-14 16:40 ` rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-14 16:40 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (11 preceding siblings ...)
2008-01-12 13:53 ` pinskia at gcc dot gnu dot org
@ 2008-01-12 15:15 ` rguenth at gcc dot gnu dot org
2008-03-14 16:40 ` rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-12 15:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from rguenth at gcc dot gnu dot org 2008-01-12 14:23 -------
Simplified C testcase (omitting the parts that are optimized). We cannot
figure out the number of iterations of this loop:
void f(int n, float *v)
{
int i;
if (n <= 0)
return;
else
{
i = 1;
do {
if (i > n) __builtin_abort ();
v[i] = 0.;
i++;
} while (i <= n);
}
}
Note that for this simplified testcase DOM figures out the redundant test,
but not if you use i != n as the exit test, as for n == 1 the assert
will trigger. If you look at the fortran IL, it does instead
} while (i++ != n);
which would be ok again, but is still not optimized.
Testcase:
extern void link_error (void);
int i, n;
int main()
{
if (i > n)
return;
if (i != n)
if (i >= n)
link_error ();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (10 preceding siblings ...)
2008-01-12 13:35 ` pinskia at gcc dot gnu dot org
@ 2008-01-12 13:53 ` pinskia at gcc dot gnu dot org
2008-01-12 15:15 ` rguenth at gcc dot gnu dot org
2008-03-14 16:40 ` rguenth at gcc dot gnu dot org
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-12 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pinskia at gcc dot gnu dot org 2008-01-12 12:49 -------
>Compile with -fbounds-checking -O2, and notice that there is still
That should be just -fbounds-check .
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (9 preceding siblings ...)
2008-01-12 13:17 ` pinskia at gcc dot gnu dot org
@ 2008-01-12 13:35 ` pinskia at gcc dot gnu dot org
2008-01-12 13:53 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-12 13:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pinskia at gcc dot gnu dot org 2008-01-12 12:48 -------
There should be no call to _gfortran_runtime_error_at and I still get one:
# i_2 = PHI <1(3), i_27(6)>
if (i_2 > size.1_4)
goto <bb 5>;
else
goto <bb 6>;
<bb 5>:
# i_32 = PHI <i_2(4)> _gfortran_runtime_error_at (&"At line 7 of file
t.f90"[1]{lb: 1 sz: 1}, &"Array reference out of bounds for array \'v\', upper
bound of dimension 1 exceeded (%ld > %ld)"[1]{lb: 1 sz: 1}, i_32, size.1_4);
Yes one call to _gfortran_runtime_error_at is removed but that is the lower
bound one.
Even the C testcase has the same issue.
we still get a call to abort:
L4:
call _abort
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2008-01-12 13:06 ` rguenth at gcc dot gnu dot org
@ 2008-01-12 13:17 ` pinskia at gcc dot gnu dot org
2008-01-12 13:35 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-01-12 13:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gcc dot gnu dot org 2008-01-12 12:44 -------
This is not fixed for me with
gcc version 4.3.0 20071110 (experimental) [trunk revision 130075] (GCC)
or with Sun Jan 6 02:53:41 UTC 2008 (revision 131347)
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-01-12 12:49 ` rguenth at gcc dot gnu dot org
@ 2008-01-12 13:06 ` rguenth at gcc dot gnu dot org
2008-01-12 13:17 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-12 13:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenth at gcc dot gnu dot org 2008-01-12 12:42 -------
Actually VRP1 catches both the fortran and the C testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-01-12 12:48 ` rguenth at gcc dot gnu dot org
@ 2008-01-12 12:49 ` rguenth at gcc dot gnu dot org
2008-01-12 13:06 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-12 12:49 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2006-05-01 10:09 ` baldrick at free dot fr
@ 2008-01-12 12:48 ` rguenth at gcc dot gnu dot org
2008-01-12 12:49 ` rguenth at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-12 12:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2008-01-12 12:38 -------
ifcombine fixes this.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2006-05-01 6:18 ` pinskia at gcc dot gnu dot org
@ 2006-05-01 10:09 ` baldrick at free dot fr
2008-01-12 12:48 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: baldrick at free dot fr @ 2006-05-01 10:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from baldrick at free dot fr 2006-05-01 10:09 -------
Re comment #5:
> so we have [1,1] UNION [2, +INF] and we just get ~[0,0] bogus
> and it also means this is PR 23744.
This is more than PR 23744: with the fix for PR 23744 applied,
__builtin_abort () is still not eliminated due to VRP failing
to eliminate the i > n comparison (symbolic range).
--
baldrick at free dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |baldrick at free dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-01-29 21:05 ` pinskia at gcc dot gnu dot org
@ 2006-05-01 6:18 ` pinskia at gcc dot gnu dot org
2006-05-01 10:09 ` baldrick at free dot fr
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-01 6:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-05-01 06:18 -------
Grrr:
Visiting PHI node: i_3 = PHI <i_17(4), i_13(13)>;
Argument #0 (4 -> 12 executable)
i_17
Value: [1, 1] EQUIVALENCES: { } (0 elements)
Argument #1 (13 -> 12 executable)
i_13
Value: [2, +INF] EQUIVALENCES: { } (0 elements)
so we have [1,1] UNION [2, +INF] and we just get ~[0,0] bogus
and it also means this is PR 23744.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |23744
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-01-07 16:20 ` pinskia at gcc dot gnu dot org
@ 2006-01-29 21:05 ` pinskia at gcc dot gnu dot org
2006-05-01 6:18 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-29 21:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-01-29 21:05 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-01-29 21:05:41
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
2006-01-02 20:23 ` [Bug tree-optimization/25643] VRP does not remove -fbounds-check " pinskia at gcc dot gnu dot org
2006-01-03 20:37 ` pinskia at gcc dot gnu dot org
@ 2006-01-07 16:20 ` pinskia at gcc dot gnu dot org
2006-01-29 21:05 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-07 16:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-01-07 16:20 -------
This was NOT fixed by the patch which fixed PR 18527.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
2006-01-02 20:23 ` [Bug tree-optimization/25643] VRP does not remove -fbounds-check " pinskia at gcc dot gnu dot org
@ 2006-01-03 20:37 ` pinskia at gcc dot gnu dot org
2006-01-07 16:20 ` pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-03 20:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-01-03 20:37 -------
This is related to PR 18527 but not fixed with -funsafe-loop-optimizations.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |18527
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
@ 2006-01-02 20:23 ` pinskia at gcc dot gnu dot org
2006-01-03 20:37 ` pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-02 20:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-01-02 20:23 -------
C testcase:
int v[10000]={0};
void f(int n)
{
int i;
if (n <= 0)
return;
if (n > 0)
{
i = 1;
do {
_Bool t = i <= 0;
_Bool t1 = i > n;
_Bool t2 = t || t1;
if (t2) __builtin_abort ();
v[i] = i*i;
i++;
} while (i != n);
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25643
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-09-03 3:24 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-25643-4@http.gcc.gnu.org/bugzilla/>
2012-06-29 13:23 ` [Bug tree-optimization/25643] VRP does not remove -fbounds-check for Fortran rguenth at gcc dot gnu.org
2023-09-03 3:24 ` pinskia at gcc dot gnu.org
2006-01-02 19:54 [Bug tree-optimization/25643] New: VRP does not remove -fbounds-checking " pinskia at gcc dot gnu dot org
2006-01-02 20:23 ` [Bug tree-optimization/25643] VRP does not remove -fbounds-check " pinskia at gcc dot gnu dot org
2006-01-03 20:37 ` pinskia at gcc dot gnu dot org
2006-01-07 16:20 ` pinskia at gcc dot gnu dot org
2006-01-29 21:05 ` pinskia at gcc dot gnu dot org
2006-05-01 6:18 ` pinskia at gcc dot gnu dot org
2006-05-01 10:09 ` baldrick at free dot fr
2008-01-12 12:48 ` rguenth at gcc dot gnu dot org
2008-01-12 12:49 ` rguenth at gcc dot gnu dot org
2008-01-12 13:06 ` rguenth at gcc dot gnu dot org
2008-01-12 13:17 ` pinskia at gcc dot gnu dot org
2008-01-12 13:35 ` pinskia at gcc dot gnu dot org
2008-01-12 13:53 ` pinskia at gcc dot gnu dot org
2008-01-12 15:15 ` rguenth at gcc dot gnu dot org
2008-03-14 16:40 ` rguenth at gcc dot gnu dot 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).