This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, libgfortran] Merge of fortran-dev IO to trunk
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- Cc: jvdelisle at verizon dot net, d at domob dot eu, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 06 Apr 2009 10:17:41 -0700
- Subject: Re: [patch, libgfortran] Merge of fortran-dev IO to trunk
- References: <200904061611.n36GBQ305948@lucas.cup.hp.com> <49DA362D.2060003@gmail.com>
- Reply-to: sje at cup dot hp dot com
On Mon, 2009-04-06 at 20:04 +0300, Janne Blomqvist wrote:
> Just out of curiosity, how does this situation arise? If you look at the
> stack trace, it should be something like
>
> convert_real
> read_f
> formatted_transfer_scalar_read
> formatted_transfer
> transfer_real
>
> where the last is the library entry point. If you look at the code,
> there is no pointer arithmetic or such done on *dest; The pointer that
> we're writing via is provided as is by user space, so the frontend
> should already have the place for the data in memory properly alYourigned.
I am not sure how we get unaligned, I am testing with
fortran.dg/arrayio_9.f90. It seems to follow your stack trace.
! { dg-do run }
! PR29563 Internal read loses data.
! Test from test case. Submitted by Jerry DeLisle
<jvdelisle@gcc.gnu.org>
! Without patch, last value in array was being skipped in the read.
program pr29563
character(len=10), dimension(3)::arraydata = (/' 1 2 3',' 4 5 6',' 7 8
9'/)
real(kind=8), dimension(3,3) :: tmp
tmp = 0.0
read(arraydata,*,iostat=iostat)((tmp(i,j),j=1,3),i=1,3)
if (tmp(3,3)-9.0.gt.0.0000001) call abort()
end program pr29563
The backtrace I see (using HP's gdb) is:
#0 0x9fffffffbd717700:0 in *_gfortrani_convert_real
(dtp=0x9fffffffffffef80,
dest=0x9ffffffffffff07c, buffer=0x6000000000021de0 "1", length=8)
at /proj/opensrc/nightly/src/trunk/libgfortran/io/read.c:154
#1 0x9fffffffbd70c8d0:0 in read_real (length=8)
at /proj/opensrc/nightly/src/trunk/libgfortran/io/list_read.c:1521
#2 0x9fffffffbd70ecd0:0 in list_formatted_read_scalar
(p=0x9ffffffffffff1a0,
kind=8, size=8)
at /proj/opensrc/nightly/src/trunk/libgfortran/io/list_read.c:1765
#3 0x9fffffffbd70f780:0 in *_gfortrani_list_formatted_read (
dtp=0x9fffffffffffef80, type=BT_REAL, size=8, nelems=1)
at /proj/opensrc/nightly/src/trunk/libgfortran/io/list_read.c:1848
#4 0x9fffffffbd71a1b0:0 in *_gfortran_transfer_real
(dtp=0x9fffffffffffef80,
p=0x9ffffffffffff1a0, kind=8)
at /proj/opensrc/nightly/src/trunk/libgfortran/io/transfer.c:1680