--- Comment #9 from hailijuan at gmail dot com 2007-10-31 07:20 ---
invalid testcase.
--
hailijuan at gmail dot com changed:
What|Removed |Added
Status|UNCONF
--- Comment #8 from hailijuan at gmail dot com 2007-10-31 07:18 ---
Subject: Re: gfortran: incorrect output for array of dynamic bounds
running a.out compiled with -fbounds-check and then get following message:
micro# ./a.out
Fortran runtime error: Array reference out of bounds for arr
--- Comment #7 from kargl at gcc dot gnu dot org 2007-10-31 06:50 ---
(In reply to comment #6)
> Subject: Re: gfortran: incorrect output for array of dynamic bounds
>
> not like that. it's right to use a(j,i) which has j as lower dimension.
> memory layout of array(0:2, 0:1) is like:
>
--- Comment #6 from hailijuan at gmail dot com 2007-10-31 06:17 ---
Subject: Re: gfortran: incorrect output for array of dynamic bounds
not like that. it's right to use a(j,i) which has j as lower dimension.
memory layout of array(0:2, 0:1) is like:
a(0,0), a(1,0), a(2,0), a(0,1), a(1,
--- Comment #5 from jvdelisle at gcc dot gnu dot org 2007-10-31 06:07
---
You have the array indexes reversed:
a(j,i)= i+j should be a(i,j) = i+j
To keep your references within the bounds of the array you defined. Use
-fbounds-check as Steve pointed out and you will get an
--- Comment #4 from kargl at gcc dot gnu dot org 2007-10-31 05:56 ---
(In reply to comment #3)
>
> exactly! but why gfortran does that? is that permitted by fortran
> standards? thanks a lot.
See my previous comment. Your program is invalid Fortran. A Fortran
compiler can do anything
--- Comment #3 from hailijuan at gmail dot com 2007-10-31 05:46 ---
Subject: Re: gfortran: incorrect output for array of dynamic bounds
exactly! but why gfortran does that? is that permitted by fortran
standards? thanks a lot.
31 Oct 2007 04:01:08 -, jvdelisle at gcc dot gnu dot o
--- Comment #2 from kargl at gcc dot gnu dot org 2007-10-31 04:08 ---
First, your program is not a valid Fortran program, so gfortran can do whatever
it wants with the code. Second, add -fbounds-check to your compiler options.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33954
--- Comment #1 from jvdelisle at gcc dot gnu dot org 2007-10-31 04:01
---
gfortran does not initialize bigarray for you, so you get what is in memory
there at the moment.
If I set bigarray = 0. I get:
0.000 0.000 0.000 0.000 0.000
0.00