public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [libgfortran, patch] Rename numeric STOP runtime functions
@ 2016-12-19 14:28 FX
  2016-12-19 15:44 ` Janne Blomqvist
  0 siblings, 1 reply; 3+ messages in thread
From: FX @ 2016-12-19 14:28 UTC (permalink / raw)
  To: GCC-Fortran-ML; +Cc: gcc-patches, Janne Blomqvist

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

When support for F2008 requirements on numeric STOP statements was implemented, the old _gfortran_stop_numeric() runtime function was made obsolete and a new _gfortran_stop_numeric_f08() function was created, which is the only one used in the front-end nowadays. The old _gfortran_stop_numeric() was kept in libgfortran for ABI compatibility.

Now that we are breaking the ABI, the attached patch removes the older _gfortran_stop_numeric() function, and renames the _gfortran_stop_numeric_f08() function into _gfortran_stop_numeric(). That way, it is in line with the names of all other PAUSE/STOP/ERROR STOP runtime functions.

Bootstrapped and regtested on x86_64-apple-darwin16.3.0.
OK to commit?

FX


[-- Attachment #2: stop.ChangeLog --]
[-- Type: application/octet-stream, Size: 449 bytes --]

2016-12-19  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	* trans.h: Remove gfor_fndecl_stop_numeric_f08.
	* trans-decl.c: Remove gfor_fndecl_stop_numeric_f08.
	* trans-stmt.c (gfc_trans_stop): Use gfor_fndecl_stop_numeric
	instead of gfor_fndecl_stop_numeric_f08.


2016-12-19  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	* gfortran.map: Remove _gfortran_stop_numeric_f08.
	* runtime/stop.c: Rename stop_numeric_f08 into stop_numeric.


[-- Attachment #3: stop.diff --]
[-- Type: application/octet-stream, Size: 4226 bytes --]

Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(revision 243794)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -98,7 +98,6 @@ static int seen_ieee_symbol;
 tree gfor_fndecl_pause_numeric;
 tree gfor_fndecl_pause_string;
 tree gfor_fndecl_stop_numeric;
-tree gfor_fndecl_stop_numeric_f08;
 tree gfor_fndecl_stop_string;
 tree gfor_fndecl_error_stop_numeric;
 tree gfor_fndecl_error_stop_string;
@@ -3470,12 +3469,6 @@ gfc_build_builtin_function_decls (void)
   /* STOP doesn't return.  */
   TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric) = 1;
 
-  gfor_fndecl_stop_numeric_f08 = gfc_build_library_function_decl (
-	get_identifier (PREFIX("stop_numeric_f08")),
-	void_type_node, 1, gfc_int4_type_node);
-  /* STOP doesn't return.  */
-  TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric_f08) = 1;
-
   gfor_fndecl_stop_string = gfc_build_library_function_decl_with_spec (
 	get_identifier (PREFIX("stop_string")), ".R.",
 	void_type_node, 2, pchar_type_node, gfc_int4_type_node);
Index: gcc/fortran/trans-stmt.c
===================================================================
--- gcc/fortran/trans-stmt.c	(revision 243794)
+++ gcc/fortran/trans-stmt.c	(working copy)
@@ -650,7 +650,7 @@ gfc_trans_stop (gfc_code *code, bool err
 				    : gfor_fndecl_error_stop_numeric)
 				 : (flag_coarray == GFC_FCOARRAY_LIB
 				    ? gfor_fndecl_caf_stop_numeric
-				    : gfor_fndecl_stop_numeric_f08), 1,
+				    : gfor_fndecl_stop_numeric), 1,
 				 fold_convert (gfc_int4_type_node, se.expr));
     }
   else
Index: gcc/fortran/trans.h
===================================================================
--- gcc/fortran/trans.h	(revision 243794)
+++ gcc/fortran/trans.h	(working copy)
@@ -784,7 +784,6 @@ void gfc_omp_firstprivatize_type_sizes (
 extern GTY(()) tree gfor_fndecl_pause_numeric;
 extern GTY(()) tree gfor_fndecl_pause_string;
 extern GTY(()) tree gfor_fndecl_stop_numeric;
-extern GTY(()) tree gfor_fndecl_stop_numeric_f08;
 extern GTY(()) tree gfor_fndecl_stop_string;
 extern GTY(()) tree gfor_fndecl_error_stop_numeric;
 extern GTY(()) tree gfor_fndecl_error_stop_string;
Index: libgfortran/gfortran.map
===================================================================
--- libgfortran/gfortran.map	(revision 243794)
+++ libgfortran/gfortran.map	(working copy)
@@ -1006,27 +1006,6 @@ GFORTRAN_1.0 {
     _gfortran_unpack0_char;
     _gfortran_unpack1;
     _gfortran_unpack1_char;
-    __iso_c_binding_c_f_pointer;
-    __iso_c_binding_c_f_pointer_d0;
-    __iso_c_binding_c_f_pointer_i1;
-    __iso_c_binding_c_f_pointer_i2;
-    __iso_c_binding_c_f_pointer_i4;
-    __iso_c_binding_c_f_pointer_i8;
-    __iso_c_binding_c_f_pointer_i16;
-    __iso_c_binding_c_f_pointer_r4;
-    __iso_c_binding_c_f_pointer_r8;
-    __iso_c_binding_c_f_pointer_r10;
-    __iso_c_binding_c_f_pointer_r16;
-    __iso_c_binding_c_f_pointer_c4;
-    __iso_c_binding_c_f_pointer_c8;
-    __iso_c_binding_c_f_pointer_c10;
-    __iso_c_binding_c_f_pointer_c16;
-    __iso_c_binding_c_f_pointer_s0;
-    __iso_c_binding_c_f_pointer_l1;
-    __iso_c_binding_c_f_pointer_l2;
-    __iso_c_binding_c_f_pointer_l4;
-    __iso_c_binding_c_f_pointer_l8;
-    __iso_c_binding_c_f_pointer_u0;
   local:
     *;
 };
@@ -1172,7 +1151,6 @@ GFORTRAN_1.4 {
     _gfortran_parity_l8;
     _gfortran_parity_l16;
     _gfortran_selected_real_kind2008;
-    _gfortran_stop_numeric_f08;
     _gfortran_transfer_array_write;
     _gfortran_transfer_character_write;
     _gfortran_transfer_character_wide_write;
Index: libgfortran/runtime/stop.c
===================================================================
--- libgfortran/runtime/stop.c	(revision 243794)
+++ libgfortran/runtime/stop.c	(working copy)
@@ -90,24 +90,6 @@ void
 stop_numeric (GFC_INTEGER_4 code)
 {
   report_exception ();
-  if (code == -1)
-    code = 0;
-  else
-    st_printf ("STOP %d\n", (int)code);
-
-  exit (code);
-}
-
-
-/* A Fortran 2008 numeric STOP statement.  */
-
-extern _Noreturn void stop_numeric_f08 (GFC_INTEGER_4);
-export_proto(stop_numeric_f08);
-
-void
-stop_numeric_f08 (GFC_INTEGER_4 code)
-{
-  report_exception ();
   st_printf ("STOP %d\n", (int)code);
   exit (code);
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libgfortran, patch] Rename numeric STOP runtime functions
  2016-12-19 14:28 [libgfortran, patch] Rename numeric STOP runtime functions FX
@ 2016-12-19 15:44 ` Janne Blomqvist
  2016-12-19 16:21   ` FX
  0 siblings, 1 reply; 3+ messages in thread
From: Janne Blomqvist @ 2016-12-19 15:44 UTC (permalink / raw)
  To: FX; +Cc: GCC-Fortran-ML, gcc-patches

On Mon, Dec 19, 2016 at 4:13 PM, FX <fxcoudert@gmail.com> wrote:
> When support for F2008 requirements on numeric STOP statements was implemented, the old _gfortran_stop_numeric() runtime function was made obsolete and a new _gfortran_stop_numeric_f08() function was created, which is the only one used in the front-end nowadays. The old _gfortran_stop_numeric() was kept in libgfortran for ABI compatibility.
>
> Now that we are breaking the ABI, the attached patch removes the older _gfortran_stop_numeric() function, and renames the _gfortran_stop_numeric_f08() function into _gfortran_stop_numeric(). That way, it is in line with the names of all other PAUSE/STOP/ERROR STOP runtime functions.
>
> Bootstrapped and regtested on x86_64-apple-darwin16.3.0.
> OK to commit?

The patch you posted contains some apparently unrelated changes to
gfortran.map. Without those, Ok.

As a minor cosmetic improvement, you could fold_convert the argument
to integer_type_node instead of gfc_int4_type_node and change the
library functions to take plain C int arguments, since the exit()
argument is a C int anyways.



-- 
Janne Blomqvist

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libgfortran, patch] Rename numeric STOP runtime functions
  2016-12-19 15:44 ` Janne Blomqvist
@ 2016-12-19 16:21   ` FX
  0 siblings, 0 replies; 3+ messages in thread
From: FX @ 2016-12-19 16:21 UTC (permalink / raw)
  To: Janne Blomqvist; +Cc: GCC-Fortran-ML, gcc-patches

> The patch you posted contains some apparently unrelated changes to
> gfortran.map. Without those, Ok.

Thanks for the reviews. Patches committed. Wiki updated. I’ll work tonight on some of the remaining items on the “abi cleanup” list.


> As a minor cosmetic improvement, you could fold_convert the argument
> to integer_type_node instead of gfc_int4_type_node and change the
> library functions to take plain C int arguments, since the exit()
> argument is a C int anyways.

Then this would need to be done with coarray functions too, so I would not feel too comfortable. I’ll leave that as an improvement if there is agreement on that side.

FX

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-19 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 14:28 [libgfortran, patch] Rename numeric STOP runtime functions FX
2016-12-19 15:44 ` Janne Blomqvist
2016-12-19 16:21   ` FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).