This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37199] array assignment from function writes out of bounds
- From: "dfranke at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Aug 2008 13:25:16 -0000
- Subject: [Bug fortran/37199] array assignment from function writes out of bounds
- References: <bug-37199-16624@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from dfranke at gcc dot gnu dot org 2008-08-22 13:25 -------
Further reduced:
program bounds_issue
real, pointer :: pdf0(:)
allocate(pdf0(0:282))
pdf0 = f(pdf0)
contains
function f(x)
real, intent(in) :: x(0:) ! x(1:), f(1:...) works
real :: f(0:ubound(x,dim=1)) ! x(-1:), f(-1:...) crashes
f = 0.0
end function
end program bounds_issue
If the lower bounds in the function argument and function return value are set
to 1 and -1 respectively, then the diff of the respective tree dumps is quite
small. Which of the seven changes which can be observed is the significant one,
I can not tell.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37199