From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32130 invoked by alias); 27 Mar 2006 17:27:43 -0000 Received: (qmail 32077 invoked by uid 48); 27 Mar 2006 17:27:40 -0000 Date: Mon, 27 Mar 2006 17:27:00 -0000 Subject: [Bug libfortran/26890] New: SIZE parameter interacts with same variable in IO list character length specification. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-03/txt/msg02659.txt.bz2 List-Id: The program below produces the correct result for the first read and nothing for the second. ifort and g95 produce the same result for each. It is my belief that this construct is not strictly standard compliant but it is widely used - I found this during my efforts to make iso_varying_string work. The code looks OK, so I think that the logic in the library needs a little bit of tweaking: nchars = 80; { struct __st_parameter_dt dt_parm.8; dt_parm.8.common.filename = "advance_io.f90"; dt_parm.8.common.line = 21; dt_parm.8.common.unit = 10; dt_parm.8.advance = "no"; dt_parm.8.advance_len = 2; dt_parm.8.format = "(a)"; dt_parm.8.format_len = 3; dt_parm.8.size = &nchars; dt_parm.8.common.flags = 13328; _gfortran_st_read (&dt_parm.8); _gfortran_transfer_character (&dt_parm.8, &buffer, NON_LVALUE_EXPR ) ; _gfortran_st_read_done (&dt_parm.8); switch (dt_parm.8.common.flags & 3) { case 3:; goto __label_000999; } } Paul character(80) :: buffer, line integer :: nchars line = "The quick brown fox jumps over the lazy dog." open (10) write (10, '(a)') trim(line) rewind (10) nchars = 80 read (10, '(a)', advance = 'no', size = nchars, eor = 998) buffer 998 print *, nchars, buffer rewind (10) buffer = "" nchars = 80 read (10, '(a)', advance = 'no', size = nchars, eor = 999) buffer (:nchars) 999 print *, nchars, buffer close (10) end -- Summary: SIZE parameter interacts with same variable in IO list character length specification. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pault at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26890