This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44582] gfortran generates wrong results due to wrong ABI in function with array return
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jun 2010 20:10:03 -0000
- Subject: [Bug fortran/44582] gfortran generates wrong results due to wrong ABI in function with array return
- References: <bug-44582-19345@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from dominiq at lps dot ens dot fr 2010-06-20 20:10 -------
With the patch in comment #10, the modified test for pr31538 from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31538#c5
integer :: a(-4:1), b(0:4)
b = 5
! a(-4:1) = b(0:4) ! Error: different shape for Array
! ! assignment at (1) on dimension 1 (6/5)
!
! gfortran: Array bound mismatch for dimension 1 of array 'f'
! NAG f95: Rank 1 of array operand has extent 5 instead of 2
i = 0
a(i:1) = f(b)
contains
function f(x)
integer :: x(:),f(size(x))
f = x
end function
end
is no longer detected with -fckeck=bounds while the test
program main
integer, dimension (2) :: x
x = (/ 1, 2 /)
x = foo ()
if (sum (x) .ne. 103) call abort
contains
function foo()
integer, dimension (2) :: foo
foo (1) = 100
foo (2) = sum (x)
end function
end program main
pass.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44582