This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/24168] New: Problems with SPREAD and/or scalarization
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2005 18:00:53 -0000
- Subject: [Bug fortran/24168] New: Problems with SPREAD and/or scalarization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program fails to compile.
program bug
implicit none
integer, parameter :: nx=4,ny=4
real, dimension(nx,ny) :: f, g
real, dimension(nx) :: x
integer :: i
x = cshift((/ (i, i = 1, nx) /), nx/2) * 2
g = spread(x, 2, ny)
!
! x and g above (which compiles) are equivalent to f below (which doesn't).
!
f = spread(cshift((/ (i, i = 1, nx) /), nx/2) * 2, 2, ny)
end program bug
kargl[236] gfc41 -o z -static f.f90
In file f.f90:9
f = spread(cshift((/ (i, i = 1, nx) /), nx/2) * 2, 2, ny)
1
Error: Incompatible ranks 2 and 1 in assignment at (1)
-fdump-parse-tree shows
ASSIGN x(FULL) __convert_i4_r4[[(((* _gfortran_cshift0_4[[(((/1, 2, 3, 4/))
(2) ((arg not-present)))]] 2)))]]
ASSIGN g(FULL) _gfortran_spread[[((x(FULL)) (2) (4))]]
ASSIGN f(FULL) _gfortran_spread[[(((* _gfortran_cshift0_4[[(((/1, 2, 3, 4/))
(2) ((arg not-present)))]] 2)) (2) (4))]]
which suggests that the scalarization of cshift0 has set the rank to 2
instead of 2.
--
Summary: Problems with SPREAD and/or scalarization
Product: gcc
Version: 4.1.0
Status: NEW
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kargl@gcc.gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24168