public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
@ 2020-10-28 20:27 ` anlauf at gcc dot gnu.org
2023-09-14 19:44 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-28 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=97039
--- Comment #9 from anlauf at gcc dot gnu.org ---
(In reply to markeggleston from comment #8)
> Changing to allocated arrays and bounds checking does not work at compile
> time but does at runtime:
>
> program test
> real, allocatable :: x(:)
> allocate(x(10))
> x = 0.0
> print *, x(0)
> deallocate(x)
> end program test
>
> $ gfortran -fbounds-check pr30802.f90
> $ ./a.out
>
> At line 5 of file pr30802.f90
> Fortran runtime error: Index '0' of dimension 1 of array 'x' below lower
> bound of 1
>
> Error termination. Backtrace:
> #0 0x400ea1 in ???
> #1 0x400f6d in ???
> #2 0x4380b2 in ???
> #3 0x438471 in ???
> #4 0x400c69 in ???
I think the point is that bounds-checking does not work for sections of rank-2
arrays. See also PR97039.
This is not I/O specific, but what Thomas said in comment#3.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
2020-10-28 20:27 ` [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check anlauf at gcc dot gnu.org
@ 2023-09-14 19:44 ` anlauf at gcc dot gnu.org
2023-09-14 20:23 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-14 19:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #10 from anlauf at gcc dot gnu.org ---
I am working on a patch.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
2020-10-28 20:27 ` [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check anlauf at gcc dot gnu.org
2023-09-14 19:44 ` anlauf at gcc dot gnu.org
@ 2023-09-14 20:23 ` anlauf at gcc dot gnu.org
2023-09-15 17:14 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-14 20:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
--- Comment #11 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-September/059756.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2023-09-14 20:23 ` anlauf at gcc dot gnu.org
@ 2023-09-15 17:14 ` cvs-commit at gcc dot gnu.org
2023-09-15 18:21 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-15 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:1cbf18978aa384bd0ed2dc29b107fc3423cf8e62
commit r14-4039-g1cbf18978aa384bd0ed2dc29b107fc3423cf8e62
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Sep 15 19:13:38 2023 +0200
Fortran: improve bounds-checking for array sections [PR30802]
gcc/fortran/ChangeLog:
PR fortran/30802
* trans-array.cc (trans_array_bound_check): Add optional argument
COMPNAME for explicit specification of array component name.
(array_bound_check_elemental): Helper function for generating
bounds-checking code for elemental dimensions.
(gfc_conv_expr_descriptor): Use bounds-checking also for elemental
dimensions, i.e. those not handled by the scalarizer.
gcc/testsuite/ChangeLog:
PR fortran/30802
* gfortran.dg/bounds_check_fail_6.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2023-09-15 17:14 ` cvs-commit at gcc dot gnu.org
@ 2023-09-15 18:21 ` anlauf at gcc dot gnu.org
2023-09-15 19:06 ` anlauf at gcc dot gnu.org
2024-03-21 17:56 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-15 18:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anthony.debeus at gmail dot com
--- Comment #13 from anlauf at gcc dot gnu.org ---
*** Bug 97039 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2023-09-15 18:21 ` anlauf at gcc dot gnu.org
@ 2023-09-15 19:06 ` anlauf at gcc dot gnu.org
2024-03-21 17:56 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-15 19:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|--- |14.0
--- Comment #14 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-14.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2023-09-15 19:06 ` anlauf at gcc dot gnu.org
@ 2024-03-21 17:56 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-21 17:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:509352069d6f166d396f4b4a86e71ea521f2ca78
commit r14-9597-g509352069d6f166d396f4b4a86e71ea521f2ca78
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 20 20:59:24 2024 +0100
Fortran: improve array component description in runtime error message
[PR30802]
Runtime error messages for array bounds violation shall use the following
scheme for a coherent, abridged description of arrays or array components
of derived types:
(1) If x is an ordinary array variable, use "x"
(2) if z is a DT scalar and x an array component at level 1, use "z%x"
(3) if z is a DT scalar and x an array component at level > 1, or
if z is a DT array and x an array (at any level), use "z...%x"
Use a new helper function abridged_ref_name for construction of that name.
gcc/fortran/ChangeLog:
PR fortran/30802
* trans-array.cc (abridged_ref_name): New helper function.
(trans_array_bound_check): Use it.
(array_bound_check_elemental): Likewise.
(gfc_conv_array_ref): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/30802
* gfortran.dg/bounds_check_17.f90: Adjust pattern.
* gfortran.dg/bounds_check_fail_8.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
2007-02-15 0:28 [Bug fortran/30802] New: out of bounds error in allocatable array " glv at maths dot otago dot ac dot nz
2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
@ 2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
2 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-04-18 15:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2010-04-18 15:31 -------
Re-confirmed.
We have no bounds checking code in fortran/io.c nor in the I/O library.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
2007-02-15 0:28 [Bug fortran/30802] New: out of bounds error in allocatable array " glv at maths dot otago dot ac dot nz
2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
@ 2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
2 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-17 22:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tkoenig at gcc dot gnu dot org 2007-12-17 22:23 -------
I think the problem is that we don't insert bounds checking
in gfc_conv_expr_descriptor.
Another test case:
$ cat index.f90
module bar
contains
subroutine foo(a)
real, dimension(:) :: a
a = 3.
end subroutine foo
end module bar
program main
use bar
real, dimension(2,2) :: a
n = 3
call foo(a(n,:))
end program main
$ gfortran index.f90
$ gfortran -fbounds-check index.f90
$ ./a.out
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
2007-02-15 0:28 [Bug fortran/30802] New: out of bounds error in allocatable array " glv at maths dot otago dot ac dot nz
@ 2007-12-08 18:07 ` fxcoudert at gcc dot gnu dot org
2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
2 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-12-08 18:07 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30802
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-03-21 17:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-30802-4@http.gcc.gnu.org/bugzilla/>
2020-10-28 20:27 ` [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check anlauf at gcc dot gnu.org
2023-09-14 19:44 ` anlauf at gcc dot gnu.org
2023-09-14 20:23 ` anlauf at gcc dot gnu.org
2023-09-15 17:14 ` cvs-commit at gcc dot gnu.org
2023-09-15 18:21 ` anlauf at gcc dot gnu.org
2023-09-15 19:06 ` anlauf at gcc dot gnu.org
2024-03-21 17:56 ` cvs-commit at gcc dot gnu.org
2007-02-15 0:28 [Bug fortran/30802] New: out of bounds error in allocatable array " glv at maths dot otago dot ac dot nz
2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
2010-04-18 15:31 ` jvdelisle 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).