diff options
author | Bud Davis <bdavis9659@comcast.net> | 2005-01-22 03:51:12 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2005-01-22 03:51:12 +0000 |
commit | b1a807057ecb701601141285c011ef637b97f3b7 (patch) | |
tree | 2558c3d156cfc7fc1cf142d5f1c70137cabcff5b /libgfortran/io/inquire.c | |
parent | 987732e0c88255f18d408d2ad35eb7bcff865083 (diff) | |
download | gcc-b1a807057ecb701601141285c011ef637b97f3b7.zip gcc-b1a807057ecb701601141285c011ef637b97f3b7.tar.gz gcc-b1a807057ecb701601141285c011ef637b97f3b7.tar.bz2 |
re PR libfortran/19314 (inquire(position=) segfaults at runtime)
2004-01-22 Bud Davis <bdavis9659@comcast.net>
PR fortran/19314
* io/inquire.c(inquire_via_unit): implement POSITION=.
* io/transfer.c(next_record): update position for
INQUIRE.
* io/rewind.c(st_rewind): update position for
INQUIRE.
* gfortran.dg/inquire_5.f90: New test.
From-SVN: r94060
Diffstat (limited to 'libgfortran/io/inquire.c')
-rw-r--r-- | libgfortran/io/inquire.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 4127f70..20fa8b3 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -166,13 +166,27 @@ inquire_via_unit (gfc_unit * u) if (ioparm.position != NULL) { if (u == NULL || u->flags.access == ACCESS_DIRECT) - p = undefined; + p = undefined; else - { - p = NULL; /* TODO: Try to decode what the standard says... */ - } - - cf_strcpy (ioparm.blank, ioparm.blank_len, p); + switch (u->flags.position) + { + case POSITION_REWIND: + p = "REWIND"; + break; + case POSITION_APPEND: + p = "APPEND"; + break; + case POSITION_ASIS: + p = "ASIS"; + break; + default: + /* if not direct access, it must be + either REWIND, APPEND, or ASIS. + ASIS seems to be the best default */ + p = "ASIS"; + break; + } + cf_strcpy (ioparm.position, ioparm.position_len, p); } if (ioparm.action != NULL) |