This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/36257] SPREAD gives wrong results with CHARACTER variables
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2008 10:03:01 -0000
- Subject: [Bug fortran/36257] SPREAD gives wrong results with CHARACTER variables
- References: <bug-36257-10259@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pault at gcc dot gnu dot org 2008-05-18 10:03 -------
Confirmed.
This is quite revealing...
implicit none
character(len=5), dimension(3,3), parameter :: &
p = reshape(["a", "b", "c", "d", "e", "f", "g", "h", "i"], [3,3])
character(len=5), dimension(3,3) :: m1
m1 = p
print *, shape (spread (p, 1, 2))
print *, spread (p, 1, 2)
print *, spread (p, 1, 2)//"z"
! print *, spread (p, 1, 2) /= spread (m1, 1, 2)
! if (any (spread (p, 1, 2) /= spread (m1, 1, 2))) call abort
end
The first two prints are OK but the third is completely screwed up. The
front-end is not providing the right shape, to judge by the array descriptors
provided for the temporaries. BTW characters are treated separately in the
library - they all go to spread_internal.
Thanks for that one! Maybe Thomas can pinpoint the problem right away?
Cheers
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-05-18 10:03:00
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36257