Executing on host: /test/gnu/gcc-3.3/objdir/gcc/testsuite/../gfortran -B/test/gn u/gcc-3.3/objdir/gcc/testsuite/../ /test/gnu/gcc-3.3/gcc/gcc/testsuite/gfortran. dg/direct_io_2.f90 -O0 -pedantic-errors -L/test/gnu/gcc-3.3/objdir/hppa64-h p-hpux11.11/./libgfortran/.libs -L/test/gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/. /libiberty -lm -o ./direct_io_2.exe (timeout = 300) PASS: gfortran.dg/direct_io_2.f90 -O0 (test for excess errors) Setting LD_LIBRARY_PATH to .:/test/gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/./libg fortran/.libs:/test/gnu/gcc-3.3/objdir/gcc:.:/test/gnu/gcc-3.3/objdir/hppa64-hp- hpux11.11/./libgfortran/.libs:/test/gnu/gcc-3.3/objdir/gcc:/opt/gnu64/gcc/gcc-3. 5.0/lib At line 9 of file /test/gnu/gcc-3.3/gcc/gcc/testsuite/gfortran.dg/direct_io_2.f9 0 Fortran runtime error: Missing RECL parameter in OPEN statement FAIL: gfortran.dg/direct_io_2.f90 -O0 execution test As the RECL parameter is there, it seems that the parsing of statements must be broken on this 64-bit target.
this is a run time library bug.
Can you attach the .t02.original dump (generated with -fdump-tree-original) please. I have an idea what might be going wrong, but I'd like to see what this looks like on your target.
Created attachment 7871 [details] .t02.original dump
Created attachment 7872 [details] Proposed patch Can you please give this a spin? The library used int where the compiler used INTEGER*4 in a few cases. I'm currently running the testsuite on i686 and it looks good so far, but I obviously can't test if it fixes the size mismatch.
Subject: Re: Missing RECL parameter in OPEN statement > Can you please give this a spin? The library used int where the compiler > used > INTEGER*4 in a few cases. I'm currently running the testsuite on i686 and it > looks good so far, but I obviously can't test if it fixes the size mismatch. Hmmm, it's actually long that changes between the 32 and 64-bit ports. Dave
Created attachment 7873 [details] with patch There is a minor typo in the CHARACTER macro in the patch. The space after ` CHARACTER' need to be removed. However, the error still occurs.
Looks as if the problem relates to the initialization or lack of the _gfortran_ioparm struct: (gdb) p (st_parameter)_gfortran_ioparm $14 = {unit = 0, err = 0, end = 0, eor = 0, list_format = 0, library_return = LIBRARY_OK, iostat = 0x0, exist = 0x0, opened = 0x0, number = 0x0, named = 0x0, rec = 0, nextrec = 0x0, size = 0x0, recl_in = 0, recl_out = 0x0, iolength = 0x0, file = 0x0, file_len = 0, status = 0x0, status_len = 0, access = 0x0, access_len = 0, form = 0x0, form_len = 0, blank = 0x0, blank_len = 0, position = 0x0, position_len = 0, action = 0x0, action_len = 0, delim = 0x0, delim_len = 0, pad = 0x0, pad_len = 0, format = 0x0, format_len = 0, advance = 0x0, advance_len = 0, name = 0x0, name_len = 0, internal_unit = 0x0, internal_unit_len = 0, sequential = 0x0, sequential_len = 0, direct = 0x0, direct_len = 0, formatted = 0x0, formatted_len = 0, unformatted = 0x0, unformatted_len = 0, read = 0x0, read_len = 0, write = 0x0, write_len = 0, readwrite = 0x0, readwrite_len = 0, namelist_name = 0x0, namelist_name_len = 0, namelist_read_mode = 0}
Ignore the last comment. Gdb is confused. The fundamental problem is the following. Here is the code generated to save the recl_in field in MAIN__. A store double word insn is being used to store the recl_in field. This is wrong as the field in an int. ldi 80,%r28 std %r28,88(%r31) The field is accessed as an int in io/open.c. Because this is a big endian target, it reads back a 0. 80 is in the following word (int).
Created attachment 7874 [details] .s file
I don't understand why my build hadn't picked up the changes to io.h, which made me miss the typo. Apart from that there's another inconsistency, cured by this patch to trans-io.c. Can you test this please? 2005-01-05 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> PR fortran/19194 * trans-io.c (gfc_build_io_library_fndecls): 'recl_in' is not a pointer field. Index: trans-io.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/fortran/trans-io.c,v retrieving revision 1.25 diff -u -p -r1.25 trans-io.c --- trans-io.c 3 Jan 2005 21:43:55 -0000 1.25 +++ trans-io.c 5 Jan 2005 17:07:59 -0000 @@ -185,7 +185,7 @@ gfc_build_io_library_fndecls (void) ADD_FIELD (nextrec, gfc_pint4_type_node); ADD_FIELD (size, gfc_pint4_type_node); - ADD_FIELD (recl_in, gfc_pint4_type_node); + ADD_FIELD (recl_in, gfc_int4_type_node); ADD_FIELD (recl_out, gfc_pint4_type_node); ADD_FIELD (iolength, gfc_pint4_type_node);
BTw the build issue is now PR 19273.
*** Bug 16288 has been marked as a duplicate of this bug. ***
Subject: Re: Missing RECL parameter in OPEN statement > Can you test this please? > > 2005-01-05 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> > > PR fortran/19194 > * trans-io.c (gfc_build_io_library_fndecls): 'recl_in' is not a > pointer > field. I'm now seeing the following error: Executing on host: /test/gnu/gcc-3.3/objdir/gcc/testsuite/../gfortran -B/test/gn u/gcc-3.3/objdir/gcc/testsuite/../ /test/gnu/gcc-3.3/gcc/gcc/testsuite/gfortran. dg/direct_io_2.f90 -O0 -pedantic-errors -L/test/gnu/gcc-3.3/objdir/hppa64-h p-hpux11.11/./libgfortran/.libs -L/test/gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/. /libiberty -lm -o ./direct_io_2.exe (timeout = 300) PASS: gfortran.dg/direct_io_2.f90 -O0 (test for excess errors) Setting LD_LIBRARY_PATH to .:/test/gnu/gcc-3.3/objdir/hppa64-hp-hpux11.11/./libg fortran/.libs:/test/gnu/gcc-3.3/objdir/gcc:.:/test/gnu/gcc-3.3/objdir/hppa64-hp- hpux11.11/./libgfortran/.libs:/test/gnu/gcc-3.3/objdir/gcc At line 15 of file /test/gnu/gcc-3.3/gcc/gcc/testsuite/gfortran.dg/direct_io_2.f 90 Fortran runtime error: Direct access data transfer requires record number FAIL: gfortran.dg/direct_io_2.f90 -O0 execution test Dave
Sigh, indeed the type for the REC parameter is wrong as well. I had checked for other wrongs, but due to unlucky formatting in io.h I missed this one. Could you please try this patch to trans-io.c instead of the previous one? 2005-01-05 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> PR fortran/19194 * trans-io.c (gfc_build_io_library_fndecls): 'rec' and 'recl_in' are not pointer fields. Index: trans-io.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/fortran/trans-io.c,v retrieving revision 1.25 diff -u -p -r1.25 trans-io.c --- trans-io.c 3 Jan 2005 21:43:55 -0000 1.25 +++ trans-io.c 6 Jan 2005 00:14:10 -0000 @@ -181,11 +181,11 @@ gfc_build_io_library_fndecls (void) ADD_FIELD (opened, gfc_pint4_type_node); ADD_FIELD (number, gfc_pint4_type_node); ADD_FIELD (named, gfc_pint4_type_node); - ADD_FIELD (rec, gfc_pint4_type_node); + ADD_FIELD (rec, gfc_int4_type_node); ADD_FIELD (nextrec, gfc_pint4_type_node); ADD_FIELD (size, gfc_pint4_type_node); - ADD_FIELD (recl_in, gfc_pint4_type_node); + ADD_FIELD (recl_in, gfc_int4_type_node); ADD_FIELD (recl_out, gfc_pint4_type_node); ADD_FIELD (iolength, gfc_pint4_type_node);
David (billingd) could you please test this last patch on MIPS if John David's (danglin) testing turns out to be successful? I could then submit it (+ cleanups to io.h) tomorrow.
Subject: Re: Missing RECL parameter in OPEN statement > Could you please try this patch to trans-io.c instead of the previous one? > > 2005-01-05 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de> > > PR fortran/19194 > * trans-io.c (gfc_build_io_library_fndecls): 'rec' and 'recl_in' are > not pointer fields. This fixes all the errors of this type in the testsuite. Will try to file PRs on the remaining problems when I get a chance. Thanks, Dave
Patch here: http://gcc.gnu.org/ml/fortran/2005-01/msg00043.html
Subject: Bug 19194 CVSROOT: /cvs/gcc Module name: gcc Changes by: tobi@gcc.gnu.org 2005-01-22 14:37:39 Modified files: libgfortran : ChangeLog libgfortran/io : io.h gcc/fortran : ChangeLog trans-io.c Log message: gcc/fortran/ PR fortran/19194 * trans-io.c (ADD_STRING): Use gfc_charlen_type_node for string length parameters. (gfc_build_io_library_fndecls): 'rec' and 'recl_in' are not pointer fields. libgfortran/ PR fortran/19194 * io/io.h (st_parameter): Use 'GFC_INTEGER_4' instead of 'int', use CHARACTER macro for definition of string valued paramters. Also fix years in recent ChangeLog entries. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.148&r2=1.149 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/io.h.diff?cvsroot=gcc&r1=1.14&r2=1.15 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.304&r2=1.305 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-io.c.diff?cvsroot=gcc&r1=1.26&r2=1.27
Fixed.