2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-09 16:41:18 +08:00

re PR fortran/52724 (Internal read with character(kind=4) data)

2012-09-29  Thomas König  <tkoenig@gcc.gnu.org>

	PR fortran/52724
	* list_read.c (next_char):  Handle kind=4 characters.
	* unix.c (open_internal4):  Correct lenth of internal file.

2012-09-29  Thomas König  <tkoenig@gcc.gnu.org>

	PR fortran/52724
	* gfortran.dg/internal_readwrite_3.f90:  New test.

From-SVN: r191854
This commit is contained in:
Thomas Koenig 2012-09-29 17:38:46 +00:00
parent df98376a39
commit 7c0de75353
5 changed files with 33 additions and 4 deletions

@ -1,3 +1,8 @@
2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52724
* gfortran.dg/internal_readwrite_3.f90: New test.
2012-09-28 Dodji Seketeli <dodji@redhat.com>
* g++.dg/warn/Wunused-local-typedefs-3.C: Move the c++-only test

@ -0,0 +1,11 @@
! { dg-do run }
! PR 52724 - this used to generate a "Bad integer" error.
program main
implicit none
integer :: i
character(len=100,kind=4) :: buffer, a
buffer = 4_"123"
read(buffer,*) i
write (a,'(I3)') i
if (a /= 4_"123") call abort
end program main

@ -1,3 +1,9 @@
2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52724
* list_read.c (next_char): Handle kind=4 characters.
* unix.c (open_internal4): Correct lenth of internal file.
2012-09-14 David Edelsohn <dje.gcc@gmail.com>
* configure: Regenerated.

@ -199,9 +199,16 @@ next_char (st_parameter_dt *dtp)
if (is_internal_unit (dtp))
{
char cc;
length = sread (dtp->u.p.current_unit->s, &cc, 1);
c = cc;
/* Check for kind=4 internal unit. */
if (dtp->common.unit)
length = sread (dtp->u.p.current_unit->s, &c, sizeof (gfc_char4_t));
else
{
char cc;
length = sread (dtp->u.p.current_unit->s, &cc, 1);
c = cc;
}
if (length < 0)
{
generate_error (&dtp->common, LIBERROR_OS, NULL);

@ -959,7 +959,7 @@ open_internal4 (char *base, int length, gfc_offset offset)
s->buffer = base;
s->buffer_offset = offset;
s->active = s->file_length = length;
s->active = s->file_length = length * sizeof (gfc_char4_t);
s->st.vptr = &mem4_vtable;