aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2006-03-22 19:09:11 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2006-03-22 19:09:11 +0000
commitd67ab5eef80ed2d4891562bf5ff791c1b2af4a97 (patch)
treeddee91463b1c5b5ef8aaf5e8a3581d490478bed9 /gcc/fortran
parent4dc7782d15938a44634f16465a4dab55a25d70d2 (diff)
downloadgcc-d67ab5eef80ed2d4891562bf5ff791c1b2af4a97.zip
gcc-d67ab5eef80ed2d4891562bf5ff791c1b2af4a97.tar.gz
gcc-d67ab5eef80ed2d4891562bf5ff791c1b2af4a97.tar.bz2
[multiple changes]
2006-03-22 Thomas Koenig <Thomas.Koenig@onlien.de> PR fortran/19303 * gfortran.h (gfc_option_t): Add record_marker. * lang.opt: Add -frecord-marker=4 and -frecord-marker=8. * trans-decl.c: Add gfor_fndecl_set_record_marker. (gfc_build_builtin_function_decls): Set gfor_fndecl_set_record_marker. (gfc_generate_function_code): If we are in the main program and -frecord-marker was provided, call set_record_marker. * options.c (gfc_handle_option): Add handling for -frecord-marker=4 and -frecord-marker=8. * invoke.texi: Document -frecord-marker. 2006-03-22 Thomas Koenig <Thomas.Koenig@onlien.de> PR fortran/19303 * libgfortran.h (compile_options_t): Add record_marker. * runtime/compile_options.c (set_record_marker): New function. * io/open.c: If we have four-byte record markers, use GFC_INTEGER_4_HUGE as default record length. * io/file_pos.c (unformatted_backspace): Handle different size record markers. * io/transfer.c (us_read): Likewise. (us_write): Likewise. (next_record_r): Likewise. (write_us_marker): Likewise. (next_record_w): Likewise. 2006-03-22 Thomas Koenig <Thomas.Koenig@online.de> PR fortran/19303 * gfortran.dg/record_marker_1.f90: New test case. * gfortran.dg/record_marker_2.f: New test case. * gfortran.dg/record_marker_3.f90: New test case. From-SVN: r112290
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog16
-rw-r--r--gcc/fortran/gfortran.h1
-rw-r--r--gcc/fortran/invoke.texi13
-rw-r--r--gcc/fortran/lang.opt8
-rw-r--r--gcc/fortran/options.c8
-rw-r--r--gcc/fortran/trans-decl.c20
6 files changed, 64 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7e36bff..da2cc08 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,7 +1,21 @@
+2006-03-22 Thomas Koenig <Thomas.Koenig@online.de>
+
+ PR fortran/19303
+ * gfortran.h (gfc_option_t): Add record_marker.
+ * lang.opt: Add -frecord-marker=4 and -frecord-marker=8.
+ * trans-decl.c: Add gfor_fndecl_set_record_marker.
+ (gfc_build_builtin_function_decls): Set
+ gfor_fndecl_set_record_marker.
+ (gfc_generate_function_code): If we are in the main program
+ and -frecord-marker was provided, call set_record_marker.
+ * options.c (gfc_handle_option): Add handling for
+ -frecord-marker=4 and -frecord-marker=8.
+ * invoke.texi: Document -frecord-marker.
+
2006-03-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/17298
- *trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): New
+ * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): New
function to implement array valued TRANSFER intrinsic.
(gfc_conv_intrinsic_function): Call the new function if TRANSFER
and non-null se->ss.
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 24c92b3..3e673a8 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1641,6 +1641,7 @@ typedef struct
int warn_nonstd_intrinsics;
int fshort_enums;
int convert;
+ int record_marker;
}
gfc_option_t;
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 627d778..e95b32b 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -145,7 +145,7 @@ by type. Explanations are in the following sections.
@item Runtime Options
@xref{Runtime Options,,Options for influencing runtime behavior}.
@gccoptlist{
--fconvert=@var{conversion}}
+-fconvert=@var{conversion} -frecord-marker=@var{length}}
@item Code Generation Options
@xref{Code Gen Options,,Options for Code Generation Conventions}.
@@ -613,6 +613,17 @@ representation for unformatted files.
@emph{This option has an effect only when used in the main program.
The @code{CONVERT} specifier and the GFORTRAN_CONVERT_UNIT environment
variable override the default specified by -fconvert.}
+
+@cindex -frecord-marker=@var{length}
+@item -frecord-marker=@var{length}
+Specify the length of record markers for unformatted files.
+Valid values for @var{length} are 4 and 8. Default is whatever
+@code{off_t} is specified to be on that particular system.
+Note that specifying @var{length} as 4 limits the record
+length of unformatted files to 2 GB. This option does not
+extend the maximum possible record length on systems where
+@code{off_t} is a four_byte quantity.
+
@end table
@node Code Gen Options
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index 7f38e10..853653a 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -233,4 +233,12 @@ fconvert=swap
Fortran RejectNegative
Swap endianness for unformatted files
+frecord-marker=4
+Fortran RejectNegative
+Use a 4-byte record marker for unformatted files
+
+frecord-marker=8
+Fortran RejectNegative
+Use an 8-byte record marker for unformatted files
+
; This comment is to ensure we retain the blank line above.
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 438bc48..18d56c5 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -615,6 +615,14 @@ gfc_handle_option (size_t scode, const char *arg, int value)
case OPT_fconvert_swap:
gfc_option.convert = CONVERT_SWAP;
break;
+
+ case OPT_frecord_marker_4:
+ gfc_option.record_marker = 4;
+ break;
+
+ case OPT_frecord_marker_8:
+ gfc_option.record_marker = 8;
+ break;
}
return result;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index e8d2cd1..2a9c0db 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -93,6 +93,7 @@ tree gfor_fndecl_runtime_error;
tree gfor_fndecl_set_fpe;
tree gfor_fndecl_set_std;
tree gfor_fndecl_set_convert;
+tree gfor_fndecl_set_record_marker;
tree gfor_fndecl_ctime;
tree gfor_fndecl_fdate;
tree gfor_fndecl_ttynam;
@@ -2297,6 +2298,10 @@ gfc_build_builtin_function_decls (void)
gfc_build_library_function_decl (get_identifier (PREFIX("set_convert")),
void_type_node, 1, gfc_c_int_type_node);
+ gfor_fndecl_set_record_marker =
+ gfc_build_library_function_decl (get_identifier (PREFIX("set_record_marker")),
+ void_type_node, 1, gfc_c_int_type_node);
+
gfor_fndecl_in_pack = gfc_build_library_function_decl (
get_identifier (PREFIX("internal_pack")),
pvoid_type_node, 1, pvoid_type_node);
@@ -2943,6 +2948,21 @@ gfc_generate_function_code (gfc_namespace * ns)
gfc_add_expr_to_block (&body, tmp);
}
+ /* If this is the main program and an -frecord-marker option was provided,
+ add a call to set_record_marker. */
+
+ if (sym->attr.is_main_program && gfc_option.record_marker != 0)
+ {
+ tree arglist, gfc_c_int_type_node;
+
+ gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
+ arglist = gfc_chainon_list (NULL_TREE,
+ build_int_cst (gfc_c_int_type_node,
+ gfc_option.record_marker));
+ tmp = build_function_call_expr (gfor_fndecl_set_record_marker, arglist);
+ gfc_add_expr_to_block (&body, tmp);
+
+ }
if (TREE_TYPE (DECL_RESULT (fndecl)) != void_type_node
&& sym->attr.subroutine)