public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/30009] Unformatted reads exceeding storage units gives EOF instead of ERR Date: Sun, 10 Dec 2006 22:17:00 -0000 [thread overview] Message-ID: <20061210221650.11020.qmail@sourceware.org> (raw) In-Reply-To: <bug-30009-13404@http.gcc.gnu.org/bugzilla/> ------- Comment #14 from tkoenig at gcc dot gnu dot org 2006-12-10 22:16 ------- Subject: Bug 30009 Author: tkoenig Date: Sun Dec 10 22:16:14 2006 New Revision: 119712 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119712 Log: 2006-12-10 Thomas Koenig <Thomas.Koenig@online.de> Backport from mainline PR libfortran/29568 * gfortran.dg/convert_implied_open.f90: Change to new default record length. * gfortran.dg/unf_short_record_1.f90: Adapt to new error message. * gfortran.dg/unformatted_subrecords_1.f90: New test. PR libfortran/30009 PR libfortran/30056 * gfortran.dg/read_eof_4.f90: Add tests. * gfortran.dg/readwrite_unf_direct_eor_1.f90: New test. * gfortran.dg/unf_read_corrupted_1.f90: New test. 2006-12-10 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/29568 * gfortran.h (gfc_option_t): Add max_subrecord_length. (top level): Define MAX_SUBRECORD_LENGTH. * lang.opt: Add option -fmax-subrecord-length=. * trans-decl.c: Add new function set_max_subrecord_length. (gfc_generate_function_code): If we are within the main program and max_subrecord_length has been set, call set_max_subrecord_length. * options.c (gfc_init_options): Add defaults for max_subrecord_lenght, convert and record_marker. (gfc_handle_option): Add handling for -fmax_subrecord_length. * invoke.texi: Document the new default for -frecord-marker=<n>. 2006-12-10 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/29568 * libgfortran/libgfortran.h (compile_options_t): Add record_marker. (top level): Define GFC_MAX_SUBRECORD_LENGTH. * runtime/compile_options.c (set_record_marker): Change default to four-byte record marker. (set_max_subrecord_length): New function. * runtime/error.c (translate_error): Change error message for short record on unformatted read. * io/io.h (gfc_unit): Add recl_subrecord, bytes_left_subrecord and continued. * io/file_pos.c (unformatted_backspace): Change default of record marker size to four bytes. Loop over subrecords. * io/open.c: Default recl is max_offset. If compile_options.max_subrecord_length has been set, set set u->recl_subrecord to its value, to the maximum value otherwise. * io/transfer.c (top level): Add prototypes for us_read, us_write, next_record_r_unf and next_record_w_unf. (read_block_direct): Separate codepaths for unformatted direct and unformatted sequential. If a recl has been set by the user, use the number of bytes left for the record if it is smaller than the read request. Loop over subrecords. Set an error if the user has set a recl and the read was short. (write_buf): Separate codepaths for unformatted direct and unformatted sequential. If a recl has been set by the user, use the number of bytes left for the record if it is smaller than the read request. Loop over subrecords. Set an error if the user has set a recl and the read was short. (us_read): Add parameter continued (to indicate that bytes_left should not be intialized). Change default of record marker size to four bytes. Use subrecord. If the subrecord length is smaller than zero, this indicates a continuation. (us_write): Add parameter continued (to indicate that the continued flag should be set). Use subrecord. (pre_position): Use 0 for continued on us_write and us_read calls. (skip_record): New function. (next_record_r_unf): New function. (next_record_r): Use next_record_r_unf. (write_us_marker): Default size for record markers is four bytes. (next_record_w_unf): New function. (next_record_w): Use next_record_w_unf. PR libfortran/30009 PR libfortran/30056 * libgfortran.h: Add ERROR_CORRUPT_FILE to error_codes. * runtime/error.c (translate_error): Add handling for ERROR_CORRUPT_FILE. * io/transfer.c (read_block_direct): Add comment about EOR for stream files. Remove test for no bytes left for direct access files. Generate an ERROR_SHORT_RECORD if the read was short. For unformatted sequential files: Check endfile condition. Remove test for no bytes left. End of file here means that the file structure has been corrupted. Pre-position the file for the next record in case of error. (write_buf): Whitespace fix. Subtract the number of bytes written from bytes_left. Added: branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/readwrite_unf_direct_eor_1.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/unf_read_corrupted_1.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/unformatted_subrecord_1.f90 Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/gfortran.h branches/gcc-4_2-branch/gcc/fortran/lang.opt branches/gcc-4_2-branch/gcc/fortran/options.c branches/gcc-4_2-branch/gcc/fortran/trans-decl.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/convert_implied_open.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/read_eof_4.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/unf_short_record_1.f90 branches/gcc-4_2-branch/libgfortran/ChangeLog branches/gcc-4_2-branch/libgfortran/io/file_pos.c branches/gcc-4_2-branch/libgfortran/io/io.h branches/gcc-4_2-branch/libgfortran/io/open.c branches/gcc-4_2-branch/libgfortran/io/transfer.c branches/gcc-4_2-branch/libgfortran/libgfortran.h branches/gcc-4_2-branch/libgfortran/runtime/compile_options.c branches/gcc-4_2-branch/libgfortran/runtime/error.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30009
next prev parent reply other threads:[~2006-12-10 22:17 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-11-28 21:34 [Bug libfortran/30009] New: Unformatted reads exceeding one record should use the next record not give EOF burnus at gcc dot gnu dot org 2006-11-28 21:49 ` [Bug libfortran/30009] " brooks at gcc dot gnu dot org 2006-11-28 21:49 ` brooks at gcc dot gnu dot org 2006-11-28 22:23 ` tkoenig at gcc dot gnu dot org 2006-11-28 22:58 ` [Bug libfortran/30009] Unformatted reads exceeding storage units gives EOF instead of ERR burnus at gcc dot gnu dot org 2006-12-02 21:56 ` tkoenig at gcc dot gnu dot org 2006-12-02 23:32 ` jvdelisle at gcc dot gnu dot org 2006-12-03 8:32 ` burnus at gcc dot gnu dot org 2006-12-03 14:06 ` tkoenig at gcc dot gnu dot org 2006-12-03 14:17 ` burnus at gcc dot gnu dot org 2006-12-03 18:56 ` tkoenig at gcc dot gnu dot org 2006-12-03 21:02 ` tkoenig at gcc dot gnu dot org 2006-12-04 2:18 ` jvdelisle at gcc dot gnu dot org 2006-12-05 19:01 ` patchapp at dberlin dot org 2006-12-06 19:26 ` tkoenig at gcc dot gnu dot org 2006-12-10 22:17 ` tkoenig at gcc dot gnu dot org [this message] 2006-12-15 22:27 ` [Bug libfortran/30009] [4.1 only] " tkoenig at gcc dot gnu dot org 2006-12-16 0:35 ` jvdelisle at gcc dot gnu dot org 2006-12-16 8:18 ` tkoenig at gcc dot gnu dot org 2007-01-02 4:48 ` jvdelisle at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20061210221650.11020.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).