diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-11-22 09:10:41 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-11-22 09:10:41 +0100 |
commit | e14568432a5df8754c845e247935fcbabd97612e (patch) | |
tree | fd3f39fc5493d036706217573269adc0cd79d272 /gcc | |
parent | 220904438f2970c4187280d3088e3c4e1017f069 (diff) | |
download | gcc-e14568432a5df8754c845e247935fcbabd97612e.zip gcc-e14568432a5df8754c845e247935fcbabd97612e.tar.gz gcc-e14568432a5df8754c845e247935fcbabd97612e.tar.bz2 |
re PR libfortran/37839 (st_parameter_dt has unwanted padding, is out of sync with compiler)
PR libfortran/37839
* trans-io.c (gfc_build_io_library_fndecls): Decrease pad size back
to 16 pointers plus 32 integers. Don't use max integer kind
alignment, only gfc_intio_kind's alignment.
(gfc_trans_inquire): Only set flags2 if mask2 is non-zero.
* ioparm.def: Fix order, bitmasks and types of inquire round, sign
and pending fields. Move u in dt before id.
* io.c (gfc_free_inquire): Free decimal and size exprs.
(match_inquire_element): Match size instead of matching blank twice.
(gfc_resolve_inquire): Resolve size.
* gfortran.dg/f2003_inquire_1.f03: New test.
* gfortran.dg/f2003_io_1.f03: Remove xfail.
* gfortran.dg/f2003_io_4.f03: Likewise.
* gfortran.dg/f2003_io_5.f03: Likewise.
* gfortran.dg/f2003_io_6.f03: Likewise.
* gfortran.dg/f2003_io_7.f03: Likewise.
* io/io.h (IOPARM_INQUIRE_HAS_ROUND, IOPARM_INQUIRE_HAS_SIGN,
IOPARM_INQUIRE_HAS_PENDING): Adjust values.
(st_parameter_inquire): Reorder and fix types of round, sign and
pending fields.
(st_parameter_43, st_parameter_44): Removed.
(st_parameter_dt): Put back struct definition directly to u.p
declaration. Change type of u.p.size_used from gfc_offset to
GFC_IO_INT. Decrease back size of u.pad to 16 pointers and
32 ints. Put id, pos, asynchronous, blank, decimal, delim,
pad, round and sign fields after the union.
* io/inquire.c (inquire_via_unit, inquire_via_filename): Only read
flags2 if it is defined.
* io/transfer.c (read_sf, read_block_form, write_block): Cast
additions to size_used to GFC_IO_INT instead of gfc_offset.
(data_transfer_init): Clear whole u.p struct. Adjust
for moving id, pos, asynchronous, blank, decimal, delim, pad,
round and sign fields from u.p directly into st_parameter_dt.
(finalize_transfer): Don't cast size_used to GFC_IO_INT.
* io/file_pos.c (st_endfile): Clear whole u.p struct.
From-SVN: r142111
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/fortran/io.c | 5 | ||||
-rw-r--r-- | gcc/fortran/ioparm.def | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-io.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 | 21 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_io_1.f03 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_io_4.f03 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_io_5.f03 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_io_6.f03 | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/f2003_io_7.f03 | 1 |
11 files changed, 56 insertions, 16 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 941186f..f1ac3ed 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/37839 + * trans-io.c (gfc_build_io_library_fndecls): Decrease pad size back + to 16 pointers plus 32 integers. Don't use max integer kind + alignment, only gfc_intio_kind's alignment. + (gfc_trans_inquire): Only set flags2 if mask2 is non-zero. + * ioparm.def: Fix order, bitmasks and types of inquire round, sign + and pending fields. Move u in dt before id. + * io.c (gfc_free_inquire): Free decimal and size exprs. + (match_inquire_element): Match size instead of matching blank twice. + (gfc_resolve_inquire): Resolve size. + 2008-11-20 Jakub Jelinek <jakub@redhat.com> PR middle-end/29215 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 1c42a96..85b712f 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -3540,9 +3540,11 @@ gfc_free_inquire (gfc_inquire *inquire) gfc_free_expr (inquire->convert); gfc_free_expr (inquire->strm_pos); gfc_free_expr (inquire->asynchronous); + gfc_free_expr (inquire->decimal); gfc_free_expr (inquire->pending); gfc_free_expr (inquire->id); gfc_free_expr (inquire->sign); + gfc_free_expr (inquire->size); gfc_free_expr (inquire->round); gfc_free (inquire); } @@ -3584,7 +3586,7 @@ match_inquire_element (gfc_inquire *inquire) RETM m = match_vtag (&tag_s_async, &inquire->asynchronous); RETM m = match_vtag (&tag_s_delim, &inquire->delim); RETM m = match_vtag (&tag_s_decimal, &inquire->decimal); - RETM m = match_vtag (&tag_s_blank, &inquire->blank); + RETM m = match_vtag (&tag_size, &inquire->size); RETM m = match_vtag (&tag_s_encoding, &inquire->encoding); RETM m = match_vtag (&tag_s_round, &inquire->round); RETM m = match_vtag (&tag_s_sign, &inquire->sign); @@ -3761,6 +3763,7 @@ gfc_resolve_inquire (gfc_inquire *inquire) RESOLVE_TAG (&tag_s_sign, inquire->sign); RESOLVE_TAG (&tag_s_round, inquire->round); RESOLVE_TAG (&tag_pending, inquire->pending); + RESOLVE_TAG (&tag_size, inquire->size); RESOLVE_TAG (&tag_id, inquire->id); if (gfc_reference_st_label (inquire->err, ST_LABEL_TARGET) == FAILURE) diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index deb1b98..eba719f 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -63,9 +63,9 @@ IOPARM (inquire, flags2, 1 << 31, int4) IOPARM (inquire, asynchronous, 1 << 0, char1) IOPARM (inquire, decimal, 1 << 1, char2) IOPARM (inquire, encoding, 1 << 2, char1) -IOPARM (inquire, pending, 1 << 3, pint4) -IOPARM (inquire, round, 1 << 4, char1) -IOPARM (inquire, sign, 1 << 5, char2) +IOPARM (inquire, round, 1 << 3, char2) +IOPARM (inquire, sign, 1 << 4, char1) +IOPARM (inquire, pending, 1 << 5, pint4) IOPARM (inquire, size, 1 << 6, pint4) IOPARM (inquire, id, 1 << 7, pint4) IOPARM (wait, common, 0, common) @@ -83,6 +83,7 @@ IOPARM (dt, format, 1 << 12, char1) IOPARM (dt, advance, 1 << 13, char2) IOPARM (dt, internal_unit, 1 << 14, char1) IOPARM (dt, namelist_name, 1 << 15, char2) +IOPARM (dt, u, 0, pad) IOPARM (dt, id, 1 << 16, pint4) IOPARM (dt, pos, 1 << 17, intio) IOPARM (dt, asynchronous, 1 << 18, char1) @@ -92,4 +93,3 @@ IOPARM (dt, delim, 1 << 21, char2) IOPARM (dt, pad, 1 << 22, char1) IOPARM (dt, round, 1 << 23, char2) IOPARM (dt, sign, 1 << 24, char1) -IOPARM (dt, u, 0, pad) diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index af46ea2..b5749ec 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -291,9 +291,9 @@ gfc_build_io_library_fndecls (void) = build_pointer_type (gfc_intio_type_node); types[IOPARM_type_parray] = pchar_type_node; types[IOPARM_type_pchar] = pchar_type_node; - pad_size = 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); + pad_size = 16 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node)); pad_size += 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (integer_type_node)); - pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size)); + pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size - 1)); types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx); /* pad actually contains pointers and integers so it needs to have an @@ -301,7 +301,7 @@ gfc_build_io_library_fndecls (void) types. See the st_parameter_dt structure in libgfortran/io/io.h for what really goes into this space. */ TYPE_ALIGN (types[IOPARM_type_pad]) = MAX (TYPE_ALIGN (pchar_type_node), - TYPE_ALIGN (gfc_get_int_type (gfc_max_integer_kind))); + TYPE_ALIGN (gfc_get_int_type (gfc_intio_kind))); for (ptype = IOPARM_ptype_common; ptype < IOPARM_ptype_num; ptype++) gfc_build_st_parameter (ptype, types); @@ -1315,10 +1315,8 @@ gfc_trans_inquire (gfc_code * code) mask2 |= set_parameter_ref (&block, &post_block,var, IOPARM_inquire_id, p->id); - set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2); - if (mask2) - mask |= IOPARM_inquire_flags2; + mask |= set_parameter_const (&block, var, IOPARM_inquire_flags2, mask2); set_parameter_const (&block, var, IOPARM_common_flags, mask); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9e449f..ef7facc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2008-11-22 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/37839 + * gfortran.dg/f2003_inquire_1.f03: New test. + * gfortran.dg/f2003_io_1.f03: Remove xfail. + * gfortran.dg/f2003_io_4.f03: Likewise. + * gfortran.dg/f2003_io_5.f03: Likewise. + * gfortran.dg/f2003_io_6.f03: Likewise. + * gfortran.dg/f2003_io_7.f03: Likewise. + 2008-11-21 Jakub Jelinek <jakub@redhat.com> PR middle-end/38200 diff --git a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 new file mode 100644 index 0000000..5f3a961 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 @@ -0,0 +1,21 @@ +! { dg-do run { target fd_truncate } } +! { dg-options "-std=gnu" } +character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding +integer :: vsize, vid +logical :: vpending + +open(10, file='mydata', asynchronous="yes", blank="null", & +& decimal="comma", encoding="utf-8", sign="plus") + +inquire(unit=10, round=sround, sign=ssign, size=vsize, id=vid, & +& pending=vpending, asynchronous=sasynchronous, decimal=sdecimal, & +& encoding=sencoding) + +if (ssign.ne."PLUS") call abort +if (sasynchronous.ne."YES") call abort +if (sdecimal.ne."COMMA") call abort +if (sencoding.ne."UTF-8") call abort +if (vpending) call abort + +close(10, status="delete") +end diff --git a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 index d5861d9..f1d67c5 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 @@ -1,6 +1,5 @@ ! { dg-do run { target fd_truncate } } ! { dg-options "-std=gnu" } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> real :: a(4), b(4) real :: c diff --git a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 index 5c45f96..92c708c 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_4.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal= feature diff --git a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 index c59e500..3949b1a 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_5.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal="comma" in namelist and complex integer :: i diff --git a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 index ad16cf6..40758e2 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_6.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_6.f03 @@ -1,5 +1,4 @@ ! { dg-do run } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of decimal="comma" in namelist, checks separators implicit none diff --git a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 index 488377d..f457417 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_7.f03 @@ -1,5 +1,4 @@ ! { dg-do run { target fd_truncate } } -! { dg-xfail-run-if "PR37839" { { ia64-*-hpux* hppa*-*-* powerpc*-*-* sparc*-*-* } && ilp32 } { "*" } { "" } } ! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> ! Test of sign=, decimal=, and blank= . program iotests |