diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-io.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/large_real_kind_form_io_1.f90 | 27 |
4 files changed, 49 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 46e1c21d457..d7da455b3d4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2005-11-06 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/24174 + PR fortran/24305 + * fortran/trans-io.c (gfc_build_io_library_fndecls): Add kind + argument to transfer_array. + (transfer_array_desc): Add kind argument. + 2005-11-06 Francois-Xavier Coudert <coudert@clipper.ens.fr> * intrinsic.c (add_functions): Add ctime and fdate intrinsics. diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 2c8a9cdec28..5eed8e83ece 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -159,10 +159,12 @@ gfc_build_io_library_fndecls (void) { tree gfc_int4_type_node; tree gfc_pint4_type_node; + tree gfc_c_int_type_node; tree ioparm_type; gfc_int4_type_node = gfc_get_int_type (4); gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node); + gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); /* Build the st_parameter structure. Information associated with I/O calls are transferred here. This must match the one defined in the @@ -271,7 +273,8 @@ gfc_build_io_library_fndecls (void) iocall_x_array = gfc_build_library_function_decl (get_identifier (PREFIX("transfer_array")), - void_type_node, 2, pvoid_type_node, + void_type_node, 3, pvoid_type_node, + gfc_c_int_type_node, gfc_charlen_type_node); /* Library entry points */ @@ -1597,14 +1600,17 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) static void transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr) { - tree args, tmp, charlen_arg; + tree args, tmp, charlen_arg, kind_arg; if (ts->type == BT_CHARACTER) charlen_arg = se->string_length; else charlen_arg = build_int_cstu (NULL_TREE, 0); + kind_arg = build_int_cst (NULL_TREE, ts->kind); + args = gfc_chainon_list (NULL_TREE, addr_expr); + args = gfc_chainon_list (args, kind_arg); args = gfc_chainon_list (args, charlen_arg); tmp = gfc_build_function_call (iocall_x_array, args); gfc_add_expr_to_block (&se->pre, tmp); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79c7ac7d032..212f2328295 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-11-06 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/24174 + PR fortran/24305 + * testsuite/gfortran.dg/large_real_kind_form_io_1.f90: New file. + 2005-11-06 Diego Novillo <dnovillo@redhat.com> PR 24670 diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_1.f90 b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_1.f90 new file mode 100644 index 00000000000..c6fb76b7d10 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_1.f90 @@ -0,0 +1,27 @@ +! { dg-do run } +! { dg-require-effective-target fortran_large_real } +! PR 24174 and PR 24305 +program large_real_kind_form_io_1 + ! This should be 10 on systems that support kind=10 + integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1) + real(kind=k) :: a,b(2), c, eps + complex(kind=k) :: d, e, f(2), g + character(len=180) :: tmp + ! Test real(k) scalar and array formatted IO + eps = 10 * spacing (2.0_k) ! 10 ulp precision is enough. + b(:) = 2.0_k + write (tmp, *) b + read (tmp, *) a, c + if (abs (a - b(1)) > eps) call abort () + if (abs (c - b(2)) > eps) call abort () + ! Complex(k) scalar and array formatted and list formatted IO + d = cmplx ( 1.0_k, 2.0_k, k) + f = d + write (tmp, *) f + read (tmp, *) e, g + if (abs (e - d) > eps) call abort () + if (abs (g - d) > eps) call abort () + write (tmp, '(2(e12.4e5, 2x))') d + read (tmp, '(2(e12.4e5, 2x))') e + if (abs (e - d) > eps) call abort() +end program large_real_kind_form_io_1 |