aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2018-02-22 18:14:21 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2018-02-22 18:14:21 +0200
commit6cc22cf4dfcfecda589cd0fc023abbeff7779279 (patch)
tree911979f9a93cb44340a7cd0c77ee209e85268f8a
parent58730d1899b1deb723c0b13984fda1768ae73408 (diff)
downloadgcc-6cc22cf4dfcfecda589cd0fc023abbeff7779279.zip
gcc-6cc22cf4dfcfecda589cd0fc023abbeff7779279.tar.gz
gcc-6cc22cf4dfcfecda589cd0fc023abbeff7779279.tar.bz2
PR 78534, 84509 Fix libgfortran API for PAUSE statement
This patch changes the libgfortran API for the PAUSE statement. By passing a GFC_INTEGER_8 it handles -fdefault-integer-8, and for the character version passing the length as a size_t. Regtested on x86_64-pc-linux-gnu, committed as obvious. gcc/fortran/ChangeLog: 2018-02-22 Janne Blomqvist <jb@gcc.gnu.org> PR 78534 PR 84509 * trans-decl.c (gfc_build_builtin_function_decls): Pass gfc_int8_type node to pause_numeric, size_type_node to pause_string. * trans-stmt.c (gfc_trans_pause): Likewise. libgfortran/ChangeLog: 2018-02-22 Janne Blomqvist <jb@gcc.gnu.org> PR 78534 PR 84509 * runtime/pause.c (pause_numeric): Modify to take GFC_INTEGER_8 argument. (pause_string): Modify to take size_t character length argument. From-SVN: r257903
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/trans-decl.c6
-rw-r--r--gcc/fortran/trans-stmt.c9
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/runtime/pause.c10
5 files changed, 30 insertions, 12 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 49b2ce9..c4cc447 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,14 @@
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
+ PR 78534
+ PR 84509
+ * trans-decl.c (gfc_build_builtin_function_decls): Pass
+ gfc_int8_type node to pause_numeric, size_type_node to
+ pause_string.
+ * trans-stmt.c (gfc_trans_pause): Likewise.
+
+2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
+
* gfortran.texi: Update Coarray API description.
* trans-decl.c (gfc_build_builtin_function_decls): Use size_t for
character lengths, int for exit codes.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 63336b3..e8c10d4 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3499,7 +3499,7 @@ gfc_build_intrinsic_function_decls (void)
void
gfc_build_builtin_function_decls (void)
{
- tree gfc_int4_type_node = gfc_get_int_type (4);
+ tree gfc_int8_type_node = gfc_get_int_type (8);
gfor_fndecl_stop_numeric = gfc_build_library_function_decl (
get_identifier (PREFIX("stop_numeric")),
@@ -3527,11 +3527,11 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_pause_numeric = gfc_build_library_function_decl (
get_identifier (PREFIX("pause_numeric")),
- void_type_node, 1, gfc_int4_type_node);
+ void_type_node, 1, gfc_int8_type_node);
gfor_fndecl_pause_string = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("pause_string")), ".R.",
- void_type_node, 2, pchar_type_node, gfc_int4_type_node);
+ void_type_node, 2, pchar_type_node, size_type_node);
gfor_fndecl_runtime_error = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("runtime_error")), ".R",
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index e9e8456..f1fe8a0 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -578,7 +578,7 @@ gfc_trans_return (gfc_code * code)
tree
gfc_trans_pause (gfc_code * code)
{
- tree gfc_int4_type_node = gfc_get_int_type (4);
+ tree gfc_int8_type_node = gfc_get_int_type (8);
gfc_se se;
tree tmp;
@@ -589,7 +589,7 @@ gfc_trans_pause (gfc_code * code)
if (code->expr1 == NULL)
{
- tmp = build_int_cst (gfc_int4_type_node, 0);
+ tmp = build_int_cst (size_type_node, 0);
tmp = build_call_expr_loc (input_location,
gfor_fndecl_pause_string, 2,
build_int_cst (pchar_type_node, 0), tmp);
@@ -599,14 +599,15 @@ gfc_trans_pause (gfc_code * code)
gfc_conv_expr (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
gfor_fndecl_pause_numeric, 1,
- fold_convert (gfc_int4_type_node, se.expr));
+ fold_convert (gfc_int8_type_node, se.expr));
}
else
{
gfc_conv_expr_reference (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
gfor_fndecl_pause_string, 2,
- se.expr, se.string_length);
+ se.expr, fold_convert (size_type_node,
+ se.string_length));
}
gfc_add_expr_to_block (&se.pre, tmp);
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 4db4968..0ef7e2c 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,13 @@
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
+ PR 78534
+ PR 84509
+ * runtime/pause.c (pause_numeric): Modify to take GFC_INTEGER_8
+ argument.
+ (pause_string): Modify to take size_t character length argument.
+
+2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
+
* libgfortran.h (stop_string): Use size_t for character length.
* runtime/stop.c (stop_string): Likewise.
(error_stop_string): Likewise.
diff --git a/libgfortran/runtime/pause.c b/libgfortran/runtime/pause.c
index 25690d8..3b4c17b 100644
--- a/libgfortran/runtime/pause.c
+++ b/libgfortran/runtime/pause.c
@@ -46,23 +46,23 @@ do_pause (void)
/* A numeric PAUSE statement. */
-extern void pause_numeric (GFC_INTEGER_4);
+extern void pause_numeric (GFC_INTEGER_8);
export_proto(pause_numeric);
void
-pause_numeric (GFC_INTEGER_4 code)
+pause_numeric (GFC_INTEGER_8 code)
{
- st_printf ("PAUSE %d\n", (int) code);
+ st_printf ("PAUSE %ld\n", (long) code);
do_pause ();
}
/* A character string or blank PAUSE statement. */
-extern void pause_string (char *string, GFC_INTEGER_4 len);
+extern void pause_string (char *string, size_t len);
export_proto(pause_string);
void
-pause_string (char *string, GFC_INTEGER_4 len)
+pause_string (char *string, size_t len)
{
estr_write ("PAUSE ");
ssize_t w = write (STDERR_FILENO, string, len);