diff mbox series

Add trailing dots to fortran io fnspecs to match signature

Message ID 20200929142042.GB58829@kam.mff.cuni.cz
State New
Headers show
Series Add trailing dots to fortran io fnspecs to match signature | expand

Commit Message

Jan Hubicka Sept. 29, 2020, 2:20 p.m. UTC
Hi,
this patch is not needed but makes it possible to sanity check that
fnspec match function signature. It turns out that there are quite few
mistakes in that in trans-decl and one mistake here.
Transfer_derived has additional parameters.

Bootstrapped/regtested x86_64-linux. OK?
Honza

	* transe-io.c (gfc_build_io_library_fndecls): Add traling "." for
	fnspecs so the match number of parameters.

Comments

Martin Liška Sept. 29, 2020, 2:36 p.m. UTC | #1
On 9/29/20 4:20 PM, Jan Hubicka wrote:
> this patch is not needed but makes it possible to sanity check that
> fnspec match function signature. It turns out that there are quite few

I'm sending the run-time sanity check patch and few more places that assert.
I'm going to test the patch.

Martin
Jan Hubicka Sept. 29, 2020, 2:45 p.m. UTC | #2
> On 9/29/20 4:20 PM, Jan Hubicka wrote:
> > this patch is not needed but makes it possible to sanity check that
> > fnspec match function signature. It turns out that there are quite few
> 
> I'm sending the run-time sanity check patch and few more places that assert.
> I'm going to test the patch.
> 
> Martin

> From 3b1ff799c08f6e7adb3eb6fb988599197c639ec0 Mon Sep 17 00:00:00 2001
> From: Martin Liska <mliska@suse.cz>
> Date: Tue, 29 Sep 2020 16:35:12 +0200
> Subject: [PATCH] Add trailing dots to
>  gfc_build_library_function_decl_with_spec.
> 
> gcc/fortran/ChangeLog:
> 
> 	* trans-decl.c (gfc_build_library_function_decl_with_spec): Add
> 	runtime assert about length of SPEC argument.
> 	(gfc_build_intrinsic_function_decls): Add trailing dots.
> 	(gfc_build_builtin_function_decls): Likewise.

My fixup is longer :)
All strings starting with R or W are wrong.  However I have instances of
miamatched lengths say for caf_register, deregister and others.
There are few cases where i dropped the sting
Such as for caf_sendget_by_ref since I was unable to make sense of it.

Honza
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 92242771dde..8a5537432be 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3484,16 +3493,16 @@ gfc_build_intrinsic_function_decls (void)
   /* Misc. functions.  */
 
   gfor_fndecl_ttynam = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("ttynam")), ".W",
+	get_identifier (PREFIX("ttynam")), ".W..",
 	void_type_node, 3, pchar_type_node, gfc_charlen_type_node,
 	integer_type_node);
 
   gfor_fndecl_fdate = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("fdate")), ".W",
+	get_identifier (PREFIX("fdate")), ".W.",
 	void_type_node, 2, pchar_type_node, gfc_charlen_type_node);
 
   gfor_fndecl_ctime = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("ctime")), ".W",
+	get_identifier (PREFIX("ctime")), ".W..",
 	void_type_node, 3, pchar_type_node, gfc_charlen_type_node,
 	gfc_int8_type_node);
 
@@ -3514,8 +3523,8 @@ gfc_build_intrinsic_function_decls (void)
   DECL_PURE_P (gfor_fndecl_si_kind) = 1;
   TREE_NOTHROW (gfor_fndecl_si_kind) = 1;
 
-  gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("selected_real_kind2008")), ".RR",
+  gfor_fndecl_sr_kind = gfc_build_library_function_decl (
+	get_identifier (PREFIX("selected_real_kind2008")), 
 	gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
 	pvoid_type_node);
   DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
@@ -3662,7 +3671,7 @@ gfc_build_intrinsic_function_decls (void)
   TREE_NOTHROW (gfor_fndecl_size0) = 1;
 
   gfor_fndecl_size1 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("size1")), ".R",
+	get_identifier (PREFIX("size1")), ".R.",
 	gfc_array_index_type, 2, pvoid_type_node, gfc_array_index_type);
   DECL_PURE_P (gfor_fndecl_size1) = 1;
   TREE_NOTHROW (gfor_fndecl_size1) = 1;
@@ -3701,7 +3710,7 @@ gfc_build_builtin_function_decls (void)
   TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric) = 1;
 
   gfor_fndecl_stop_string = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("stop_string")), ".R.",
+	get_identifier (PREFIX("stop_string")), ".R..",
 	void_type_node, 3, pchar_type_node, size_type_node,
 	boolean_type_node);
   /* STOP doesn't return.  */
@@ -3714,7 +3723,7 @@ gfc_build_builtin_function_decls (void)
   TREE_THIS_VOLATILE (gfor_fndecl_error_stop_numeric) = 1;
 
   gfor_fndecl_error_stop_string = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("error_stop_string")), ".R.",
+	get_identifier (PREFIX("error_stop_string")), ".R..",
 	void_type_node, 3, pchar_type_node, size_type_node,
 	boolean_type_node);
   /* ERROR STOP doesn't return.  */
@@ -3841,50 +3850,50 @@ gfc_build_builtin_function_decls (void)
 	get_identifier (PREFIX("caf_num_images")), integer_type_node,
 	2, integer_type_node, integer_type_node);
 
-      gfor_fndecl_caf_register = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_register")), "RRWWWWR", void_type_node, 7,
+      gfor_fndecl_caf_register = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_register")), void_type_node, 7,
 	size_type_node, integer_type_node, ppvoid_type_node, pvoid_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node, 5,
+	get_identifier (PREFIX("caf_deregister")), ".W.WW.", void_type_node, 5,
 	ppvoid_type_node, integer_type_node, pint_type, pchar_type_node,
 	size_type_node);
 
-      gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10,
+      gfor_fndecl_caf_get = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_get")), void_type_node, 10,
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, pint_type);
 
-      gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_send")), ".R.RRRRRRWR", void_type_node, 11,
+      gfor_fndecl_caf_send = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_send")), void_type_node, 11,
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, pint_type, pvoid_type_node);
 
-      gfor_fndecl_caf_sendget = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_sendget")), ".R.RRRR.RRRRRR",
+      gfor_fndecl_caf_sendget = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_sendget")),
 	void_type_node,	14, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pvoid_type_node, pvoid_type_node, size_type_node,
 	integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node,
 	integer_type_node, boolean_type_node, integer_type_node);
 
-      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_get_by_ref")), ".RWRRRRRWR", void_type_node,
+      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_get_by_ref")), void_type_node,
 	10, pvoid_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
 
-      gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_send_by_ref")), ".RRRRRRRWR",
+      gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_send_by_ref")),
 	void_type_node,	10, pvoid_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
 
       gfor_fndecl_caf_sendget_by_ref
-	  = gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_sendget_by_ref")), ".RR.RRRRRWWRR",
+	  = gfc_build_library_function_decl (
+	    get_identifier (PREFIX("caf_sendget_by_ref")),
 	    void_type_node, 13, pvoid_type_node, integer_type_node,
 	    pvoid_type_node, pvoid_type_node, integer_type_node,
 	    pvoid_type_node, integer_type_node, integer_type_node,
@@ -3892,15 +3901,15 @@ gfc_build_builtin_function_decls (void)
 	    integer_type_node);
 
       gfor_fndecl_caf_sync_all = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_sync_all")), ".WW", void_type_node,
+	get_identifier (PREFIX("caf_sync_all")), ".WW.", void_type_node,
 	3, pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_sync_memory = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_sync_memory")), ".WW", void_type_node,
+	get_identifier (PREFIX("caf_sync_memory")), ".WW.", void_type_node,
 	3, pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_sync_images = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_sync_images")), ".RRWW", void_type_node,
+	get_identifier (PREFIX("caf_sync_images")), "..RRW.", void_type_node,
 	5, integer_type_node, pint_type, pint_type,
 	pchar_type_node, size_type_node);
 
@@ -3916,8 +3925,8 @@ gfc_build_builtin_function_decls (void)
       /* CAF's ERROR STOP doesn't return.  */
       TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop_str) = 1;
 
-      gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_stop_numeric")), ".R.",
+      gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_stop_numeric")), 
 	void_type_node, 1, integer_type_node);
       /* CAF's STOP doesn't return.  */
       TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_numeric) = 1;
@@ -3929,49 +3938,49 @@ gfc_build_builtin_function_decls (void)
       TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_str) = 1;
 
       gfor_fndecl_caf_atomic_def = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_define")), "R..RW",
+	get_identifier (PREFIX("caf_atomic_define")), ".R..RW..",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pint_type, integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_ref")), "R..WW",
+	get_identifier (PREFIX("caf_atomic_ref")), ".R..WW..",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pint_type, integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_cas = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_cas")), "R..WRRW",
+	get_identifier (PREFIX("caf_atomic_cas")), ".R..WRRW..",
 	void_type_node, 9, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pvoid_type_node, pvoid_type_node, pint_type,
 	integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_op = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_op")), ".R..RWW",
+	get_identifier (PREFIX("caf_atomic_op")), "..R..RWW..",
 	void_type_node, 9, integer_type_node, pvoid_type_node, size_type_node,
 	integer_type_node, pvoid_type_node, pvoid_type_node, pint_type,
 	integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_lock = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_lock")), "R..WWW",
+	get_identifier (PREFIX("caf_lock")), ".R..WWW.",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_unlock = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_unlock")), "R..WW",
+	get_identifier (PREFIX("caf_unlock")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_post = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_post")), "R..WW",
+	get_identifier (PREFIX("caf_event_post")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_wait = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_wait")), "R..WW",
+	get_identifier (PREFIX("caf_event_wait")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_query = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_query")), "R..WW",
+	get_identifier (PREFIX("caf_event_query")), ".R..WW",
 	void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pint_type);
 
@@ -3982,19 +3991,19 @@ gfc_build_builtin_function_decls (void)
 
       gfor_fndecl_caf_failed_images
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_failed_images")), "WRR",
+	    get_identifier (PREFIX("caf_failed_images")), ".WR.",
 	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_caf_form_team
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_form_team")), "RWR",
+	    get_identifier (PREFIX("caf_form_team")), ".RW.",
 	    void_type_node, 3, integer_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_caf_change_team
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_change_team")), "RR",
+	    get_identifier (PREFIX("caf_change_team")), ".R.",
 	    void_type_node, 2, ppvoid_type_node,
 	    integer_type_node);
 
@@ -4003,49 +4012,49 @@ gfc_build_builtin_function_decls (void)
 	    get_identifier (PREFIX("caf_end_team")), void_type_node, 0);
 
       gfor_fndecl_caf_get_team
-	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_get_team")), "R",
+	= gfc_build_library_function_decl (
+	    get_identifier (PREFIX("caf_get_team")),
 	    void_type_node, 1, integer_type_node);
 
       gfor_fndecl_caf_sync_team
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_sync_team")), "RR",
+	    get_identifier (PREFIX("caf_sync_team")), ".R.",
 	    void_type_node, 2, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_caf_team_number
-      	= gfc_build_library_function_decl_with_spec (
-      	    get_identifier (PREFIX("caf_team_number")), "R",
+      	= gfc_build_library_function_decl (
+      	    get_identifier (PREFIX("caf_team_number")), 
       	    integer_type_node, 1, integer_type_node);
 
       gfor_fndecl_caf_image_status
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_image_status")), "RR",
+	    get_identifier (PREFIX("caf_image_status")), "..R",
 	    integer_type_node, 2, integer_type_node, ppvoid_type_node);
 
       gfor_fndecl_caf_stopped_images
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_stopped_images")), "WRR",
+	    get_identifier (PREFIX("caf_stopped_images")), ".WR.",
 	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_co_broadcast = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_broadcast")), "W.WW",
+	get_identifier (PREFIX("caf_co_broadcast")), ".W.WW.",
 	void_type_node, 5, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_co_max = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_max")), "W.WW",
+	get_identifier (PREFIX("caf_co_max")), ".W.WW..",
 	void_type_node, 6, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, integer_type_node, size_type_node);
 
       gfor_fndecl_co_min = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_min")), "W.WW",
+	get_identifier (PREFIX("caf_co_min")), ".W.WW..",
 	void_type_node, 6, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, integer_type_node, size_type_node);
 
       gfor_fndecl_co_reduce = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_reduce")), "W.R.WW",
+	get_identifier (PREFIX("caf_co_reduce")), ".W.R.WW..",
 	void_type_node, 8, pvoid_type_node,
 	build_pointer_type (build_varargs_function_type_list (void_type_node,
 							      NULL_TREE)),
@@ -4053,12 +4062,12 @@ gfc_build_builtin_function_decls (void)
 	integer_type_node, size_type_node);
 
       gfor_fndecl_co_sum = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_sum")), "W.WW",
+	get_identifier (PREFIX("caf_co_sum")), ".W.WW.",
 	void_type_node, 5, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_is_present")), "RRR",
+	get_identifier (PREFIX("caf_is_present")), ".R.R",
 	integer_type_node, 3, pvoid_type_node, integer_type_node,
 	pvoid_type_node);
     }
Martin Liška Sept. 29, 2020, 2:58 p.m. UTC | #3
On 9/29/20 4:45 PM, Jan Hubicka wrote:
> My fixup is longer:)

Heh. So please include my gcc_checking_assert hunk to your patch.

Martin

> All strings starting with R or W are wrong.  However I have instances of
> miamatched lengths say for caf_register, deregister and others.
> There are few cases where i dropped the sting
> Such as for caf_sendget_by_ref since I was unable to make sense of it.
Richard Biener Sept. 29, 2020, 3:13 p.m. UTC | #4
On September 29, 2020 4:20:42 PM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
>Hi,
>this patch is not needed but makes it possible to sanity check that
>fnspec match function signature. It turns out that there are quite few
>mistakes in that in trans-decl and one mistake here.
>Transfer_derived has additional parameters.

Hmm, omitting trailing dots was on purpose to make the string short (also consider varargs...).  You can still sanity check the prefix, no? 

>Bootstrapped/regtested x86_64-linux. OK?
>Honza
>
>	* transe-io.c (gfc_build_io_library_fndecls): Add traling "." for
>	fnspecs so the match number of parameters.
>diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
>index 21bdd5ef0d8..363cca51ef9 100644
>--- a/gcc/fortran/trans-io.c
>+++ b/gcc/fortran/trans-io.c
>@@ -328,86 +328,86 @@ gfc_build_io_library_fndecls (void)
>dt_parm_type = build_pointer_type (st_parameter[IOPARM_ptype_dt].type);
> 
> iocall[IOCALL_X_INTEGER] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_integer")), ".wW",
>+	get_identifier (PREFIX("transfer_integer")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_INTEGER_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_integer_write")), ".wR",
>+	get_identifier (PREFIX("transfer_integer_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
> iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_logical")), ".wW",
>+	get_identifier (PREFIX("transfer_logical")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_LOGICAL_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_logical_write")), ".wR",
>+	get_identifier (PREFIX("transfer_logical_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_CHARACTER] = gfc_build_library_function_decl_with_spec
>(
>-	get_identifier (PREFIX("transfer_character")), ".wW",
>+	get_identifier (PREFIX("transfer_character")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node,
>gfc_charlen_type_node);
> 
>iocall[IOCALL_X_CHARACTER_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_character_write")), ".wR",
>+	get_identifier (PREFIX("transfer_character_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node,
>gfc_charlen_type_node);
> 
>iocall[IOCALL_X_CHARACTER_WIDE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_character_wide")), ".wW",
>+	get_identifier (PREFIX("transfer_character_wide")), ".wW..",
> 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> 	gfc_charlen_type_node, gfc_int4_type_node);
> 
>   iocall[IOCALL_X_CHARACTER_WIDE_WRITE] =
>     gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_character_wide_write")), ".wR",
>+	get_identifier (PREFIX("transfer_character_wide_write")), ".wR..",
> 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> 	gfc_charlen_type_node, gfc_int4_type_node);
> 
>   iocall[IOCALL_X_REAL] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_real")), ".wW",
>+	get_identifier (PREFIX("transfer_real")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_REAL_WRITE] = gfc_build_library_function_decl_with_spec
>(
>-	get_identifier (PREFIX("transfer_real_write")), ".wR",
>+	get_identifier (PREFIX("transfer_real_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
> iocall[IOCALL_X_COMPLEX] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_complex")), ".wW",
>+	get_identifier (PREFIX("transfer_complex")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_COMPLEX_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_complex_write")), ".wR",
>+	get_identifier (PREFIX("transfer_complex_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>   /* Version for __float128.  */
> iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_real128")), ".wW",
>+	get_identifier (PREFIX("transfer_real128")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_REAL128_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_real128_write")), ".wR",
>+	get_identifier (PREFIX("transfer_real128_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec
>(
>-	get_identifier (PREFIX("transfer_complex128")), ".wW",
>+	get_identifier (PREFIX("transfer_complex128")), ".wW.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>iocall[IOCALL_X_COMPLEX128_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_complex128_write")), ".wR",
>+	get_identifier (PREFIX("transfer_complex128_write")), ".wR.",
>	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> 
>   iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_array")), ".ww",
>+	get_identifier (PREFIX("transfer_array")), ".ww..",
> 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> 	integer_type_node, gfc_charlen_type_node);
> 
>iocall[IOCALL_X_ARRAY_WRITE] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_array_write")), ".wr",
>+	get_identifier (PREFIX("transfer_array_write")), ".wr..",
> 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> 	integer_type_node, gfc_charlen_type_node);
> 
> iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("transfer_derived")), ".wrR",
>-	void_type_node, 2, dt_parm_type, pvoid_type_node, pchar_type_node);
>+	get_identifier (PREFIX("transfer_derived")), ".wr",
>+	void_type_node, 2, dt_parm_type, pvoid_type_node);
> 
>   /* Library entry points */
> 
>@@ -475,18 +475,18 @@ gfc_build_io_library_fndecls (void)
> 	void_type_node, 1, dt_parm_type);
> 
>iocall[IOCALL_SET_NML_VAL] = gfc_build_library_function_decl_with_spec
>(
>-	get_identifier (PREFIX("st_set_nml_var")), ".w.R",
>+	get_identifier (PREFIX("st_set_nml_var")), ".w.R...",
> 	void_type_node, 6, dt_parm_type, pvoid_type_node, pvoid_type_node,
> 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node());
> 
>iocall[IOCALL_SET_NML_DTIO_VAL] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R",
>+	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R.....",
> 	void_type_node, 8, dt_parm_type, pvoid_type_node, pvoid_type_node,
> 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node(),
> 	pvoid_type_node, pvoid_type_node);
> 
>iocall[IOCALL_SET_NML_VAL_DIM] =
>gfc_build_library_function_decl_with_spec (
>-	get_identifier (PREFIX("st_set_nml_var_dim")), ".w",
>+	get_identifier (PREFIX("st_set_nml_var_dim")), ".w....",
> 	void_type_node, 5, dt_parm_type, gfc_int4_type_node,
> 	gfc_array_index_type, gfc_array_index_type, gfc_array_index_type);
> }
Jan Hubicka Sept. 29, 2020, 4:39 p.m. UTC | #5
> On September 29, 2020 4:20:42 PM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
> >Hi,
> >this patch is not needed but makes it possible to sanity check that
> >fnspec match function signature. It turns out that there are quite few
> >mistakes in that in trans-decl and one mistake here.
> >Transfer_derived has additional parameters.
> 
> Hmm, omitting trailing dots was on purpose to make the string short (also consider varargs...).  You can still sanity check the prefix, no? 

Yes, I check the prefix and check that only permitted letters appears on
given positions.  However it seems there is enough fuzz to justify one
extra byte or two in the string (it is not very long anyway).

I only check it in gfc_build infrastructure and allow early ending
strings otherwise.

I do not have very strong opinionshere, but it seems it is easy to shit
the string by one or miss a middle argument (especially for calls with
13 parameters) that is caught by this check.

I was also consiering teaching fortran to check that R/W is used only
for pointer type parameters (but did not implement it)
Honza
> 
> >Bootstrapped/regtested x86_64-linux. OK?
> >Honza
> >
> >	* transe-io.c (gfc_build_io_library_fndecls): Add traling "." for
> >	fnspecs so the match number of parameters.
> >diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
> >index 21bdd5ef0d8..363cca51ef9 100644
> >--- a/gcc/fortran/trans-io.c
> >+++ b/gcc/fortran/trans-io.c
> >@@ -328,86 +328,86 @@ gfc_build_io_library_fndecls (void)
> >dt_parm_type = build_pointer_type (st_parameter[IOPARM_ptype_dt].type);
> > 
> > iocall[IOCALL_X_INTEGER] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_integer")), ".wW",
> >+	get_identifier (PREFIX("transfer_integer")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_INTEGER_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_integer_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_integer_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> > iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_logical")), ".wW",
> >+	get_identifier (PREFIX("transfer_logical")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_LOGICAL_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_logical_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_logical_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_CHARACTER] = gfc_build_library_function_decl_with_spec
> >(
> >-	get_identifier (PREFIX("transfer_character")), ".wW",
> >+	get_identifier (PREFIX("transfer_character")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node,
> >gfc_charlen_type_node);
> > 
> >iocall[IOCALL_X_CHARACTER_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_character_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_character_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node,
> >gfc_charlen_type_node);
> > 
> >iocall[IOCALL_X_CHARACTER_WIDE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_character_wide")), ".wW",
> >+	get_identifier (PREFIX("transfer_character_wide")), ".wW..",
> > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > 	gfc_charlen_type_node, gfc_int4_type_node);
> > 
> >   iocall[IOCALL_X_CHARACTER_WIDE_WRITE] =
> >     gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_character_wide_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_character_wide_write")), ".wR..",
> > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > 	gfc_charlen_type_node, gfc_int4_type_node);
> > 
> >   iocall[IOCALL_X_REAL] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_real")), ".wW",
> >+	get_identifier (PREFIX("transfer_real")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_REAL_WRITE] = gfc_build_library_function_decl_with_spec
> >(
> >-	get_identifier (PREFIX("transfer_real_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_real_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> > iocall[IOCALL_X_COMPLEX] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_complex")), ".wW",
> >+	get_identifier (PREFIX("transfer_complex")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_COMPLEX_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_complex_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_complex_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >   /* Version for __float128.  */
> > iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_real128")), ".wW",
> >+	get_identifier (PREFIX("transfer_real128")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_REAL128_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_real128_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_real128_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec
> >(
> >-	get_identifier (PREFIX("transfer_complex128")), ".wW",
> >+	get_identifier (PREFIX("transfer_complex128")), ".wW.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >iocall[IOCALL_X_COMPLEX128_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_complex128_write")), ".wR",
> >+	get_identifier (PREFIX("transfer_complex128_write")), ".wR.",
> >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > 
> >   iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_array")), ".ww",
> >+	get_identifier (PREFIX("transfer_array")), ".ww..",
> > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > 	integer_type_node, gfc_charlen_type_node);
> > 
> >iocall[IOCALL_X_ARRAY_WRITE] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_array_write")), ".wr",
> >+	get_identifier (PREFIX("transfer_array_write")), ".wr..",
> > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > 	integer_type_node, gfc_charlen_type_node);
> > 
> > iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("transfer_derived")), ".wrR",
> >-	void_type_node, 2, dt_parm_type, pvoid_type_node, pchar_type_node);
> >+	get_identifier (PREFIX("transfer_derived")), ".wr",
> >+	void_type_node, 2, dt_parm_type, pvoid_type_node);
> > 
> >   /* Library entry points */
> > 
> >@@ -475,18 +475,18 @@ gfc_build_io_library_fndecls (void)
> > 	void_type_node, 1, dt_parm_type);
> > 
> >iocall[IOCALL_SET_NML_VAL] = gfc_build_library_function_decl_with_spec
> >(
> >-	get_identifier (PREFIX("st_set_nml_var")), ".w.R",
> >+	get_identifier (PREFIX("st_set_nml_var")), ".w.R...",
> > 	void_type_node, 6, dt_parm_type, pvoid_type_node, pvoid_type_node,
> > 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node());
> > 
> >iocall[IOCALL_SET_NML_DTIO_VAL] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R",
> >+	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R.....",
> > 	void_type_node, 8, dt_parm_type, pvoid_type_node, pvoid_type_node,
> > 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node(),
> > 	pvoid_type_node, pvoid_type_node);
> > 
> >iocall[IOCALL_SET_NML_VAL_DIM] =
> >gfc_build_library_function_decl_with_spec (
> >-	get_identifier (PREFIX("st_set_nml_var_dim")), ".w",
> >+	get_identifier (PREFIX("st_set_nml_var_dim")), ".w....",
> > 	void_type_node, 5, dt_parm_type, gfc_int4_type_node,
> > 	gfc_array_index_type, gfc_array_index_type, gfc_array_index_type);
> > }
>
Richard Biener Sept. 30, 2020, 6:26 a.m. UTC | #6
On Tue, 29 Sep 2020, Jan Hubicka wrote:

> > On September 29, 2020 4:20:42 PM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
> > >Hi,
> > >this patch is not needed but makes it possible to sanity check that
> > >fnspec match function signature. It turns out that there are quite few
> > >mistakes in that in trans-decl and one mistake here.
> > >Transfer_derived has additional parameters.
> > 
> > Hmm, omitting trailing dots was on purpose to make the string short (also consider varargs...).  You can still sanity check the prefix, no? 
> 
> Yes, I check the prefix and check that only permitted letters appears on
> given positions.  However it seems there is enough fuzz to justify one
> extra byte or two in the string (it is not very long anyway).
> 
> I only check it in gfc_build infrastructure and allow early ending
> strings otherwise.

Ah, OK.

Fair enough then, thus OK

Richard.

> I do not have very strong opinionshere, but it seems it is easy to shit
> the string by one or miss a middle argument (especially for calls with
> 13 parameters) that is caught by this check.
> 
> I was also consiering teaching fortran to check that R/W is used only
> for pointer type parameters (but did not implement it)
> Honza
> > 
> > >Bootstrapped/regtested x86_64-linux. OK?
> > >Honza
> > >
> > >	* transe-io.c (gfc_build_io_library_fndecls): Add traling "." for
> > >	fnspecs so the match number of parameters.
> > >diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
> > >index 21bdd5ef0d8..363cca51ef9 100644
> > >--- a/gcc/fortran/trans-io.c
> > >+++ b/gcc/fortran/trans-io.c
> > >@@ -328,86 +328,86 @@ gfc_build_io_library_fndecls (void)
> > >dt_parm_type = build_pointer_type (st_parameter[IOPARM_ptype_dt].type);
> > > 
> > > iocall[IOCALL_X_INTEGER] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_integer")), ".wW",
> > >+	get_identifier (PREFIX("transfer_integer")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_INTEGER_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_integer_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_integer_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > > iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_logical")), ".wW",
> > >+	get_identifier (PREFIX("transfer_logical")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_LOGICAL_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_logical_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_logical_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_CHARACTER] = gfc_build_library_function_decl_with_spec
> > >(
> > >-	get_identifier (PREFIX("transfer_character")), ".wW",
> > >+	get_identifier (PREFIX("transfer_character")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node,
> > >gfc_charlen_type_node);
> > > 
> > >iocall[IOCALL_X_CHARACTER_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_character_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_character_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node,
> > >gfc_charlen_type_node);
> > > 
> > >iocall[IOCALL_X_CHARACTER_WIDE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_character_wide")), ".wW",
> > >+	get_identifier (PREFIX("transfer_character_wide")), ".wW..",
> > > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > > 	gfc_charlen_type_node, gfc_int4_type_node);
> > > 
> > >   iocall[IOCALL_X_CHARACTER_WIDE_WRITE] =
> > >     gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_character_wide_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_character_wide_write")), ".wR..",
> > > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > > 	gfc_charlen_type_node, gfc_int4_type_node);
> > > 
> > >   iocall[IOCALL_X_REAL] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_real")), ".wW",
> > >+	get_identifier (PREFIX("transfer_real")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_REAL_WRITE] = gfc_build_library_function_decl_with_spec
> > >(
> > >-	get_identifier (PREFIX("transfer_real_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_real_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > > iocall[IOCALL_X_COMPLEX] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_complex")), ".wW",
> > >+	get_identifier (PREFIX("transfer_complex")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_COMPLEX_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_complex_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_complex_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >   /* Version for __float128.  */
> > > iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_real128")), ".wW",
> > >+	get_identifier (PREFIX("transfer_real128")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_REAL128_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_real128_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_real128_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec
> > >(
> > >-	get_identifier (PREFIX("transfer_complex128")), ".wW",
> > >+	get_identifier (PREFIX("transfer_complex128")), ".wW.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >iocall[IOCALL_X_COMPLEX128_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_complex128_write")), ".wR",
> > >+	get_identifier (PREFIX("transfer_complex128_write")), ".wR.",
> > >	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
> > > 
> > >   iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_array")), ".ww",
> > >+	get_identifier (PREFIX("transfer_array")), ".ww..",
> > > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > > 	integer_type_node, gfc_charlen_type_node);
> > > 
> > >iocall[IOCALL_X_ARRAY_WRITE] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_array_write")), ".wr",
> > >+	get_identifier (PREFIX("transfer_array_write")), ".wr..",
> > > 	void_type_node, 4, dt_parm_type, pvoid_type_node,
> > > 	integer_type_node, gfc_charlen_type_node);
> > > 
> > > iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("transfer_derived")), ".wrR",
> > >-	void_type_node, 2, dt_parm_type, pvoid_type_node, pchar_type_node);
> > >+	get_identifier (PREFIX("transfer_derived")), ".wr",
> > >+	void_type_node, 2, dt_parm_type, pvoid_type_node);
> > > 
> > >   /* Library entry points */
> > > 
> > >@@ -475,18 +475,18 @@ gfc_build_io_library_fndecls (void)
> > > 	void_type_node, 1, dt_parm_type);
> > > 
> > >iocall[IOCALL_SET_NML_VAL] = gfc_build_library_function_decl_with_spec
> > >(
> > >-	get_identifier (PREFIX("st_set_nml_var")), ".w.R",
> > >+	get_identifier (PREFIX("st_set_nml_var")), ".w.R...",
> > > 	void_type_node, 6, dt_parm_type, pvoid_type_node, pvoid_type_node,
> > > 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node());
> > > 
> > >iocall[IOCALL_SET_NML_DTIO_VAL] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R",
> > >+	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R.....",
> > > 	void_type_node, 8, dt_parm_type, pvoid_type_node, pvoid_type_node,
> > > 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node(),
> > > 	pvoid_type_node, pvoid_type_node);
> > > 
> > >iocall[IOCALL_SET_NML_VAL_DIM] =
> > >gfc_build_library_function_decl_with_spec (
> > >-	get_identifier (PREFIX("st_set_nml_var_dim")), ".w",
> > >+	get_identifier (PREFIX("st_set_nml_var_dim")), ".w....",
> > > 	void_type_node, 5, dt_parm_type, gfc_int4_type_node,
> > > 	gfc_array_index_type, gfc_array_index_type, gfc_array_index_type);
> > > }
> > 
>
diff mbox series

Patch

diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 21bdd5ef0d8..363cca51ef9 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -328,86 +328,86 @@  gfc_build_io_library_fndecls (void)
   dt_parm_type = build_pointer_type (st_parameter[IOPARM_ptype_dt].type);
 
   iocall[IOCALL_X_INTEGER] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_integer")), ".wW",
+	get_identifier (PREFIX("transfer_integer")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_INTEGER_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_integer_write")), ".wR",
+	get_identifier (PREFIX("transfer_integer_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_logical")), ".wW",
+	get_identifier (PREFIX("transfer_logical")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_LOGICAL_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_logical_write")), ".wR",
+	get_identifier (PREFIX("transfer_logical_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_CHARACTER] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_character")), ".wW",
+	get_identifier (PREFIX("transfer_character")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_charlen_type_node);
 
   iocall[IOCALL_X_CHARACTER_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_character_write")), ".wR",
+	get_identifier (PREFIX("transfer_character_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_charlen_type_node);
 
   iocall[IOCALL_X_CHARACTER_WIDE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_character_wide")), ".wW",
+	get_identifier (PREFIX("transfer_character_wide")), ".wW..",
 	void_type_node, 4, dt_parm_type, pvoid_type_node,
 	gfc_charlen_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_CHARACTER_WIDE_WRITE] =
     gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_character_wide_write")), ".wR",
+	get_identifier (PREFIX("transfer_character_wide_write")), ".wR..",
 	void_type_node, 4, dt_parm_type, pvoid_type_node,
 	gfc_charlen_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_REAL] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_real")), ".wW",
+	get_identifier (PREFIX("transfer_real")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_REAL_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_real_write")), ".wR",
+	get_identifier (PREFIX("transfer_real_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_COMPLEX] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_complex")), ".wW",
+	get_identifier (PREFIX("transfer_complex")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_COMPLEX_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_complex_write")), ".wR",
+	get_identifier (PREFIX("transfer_complex_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   /* Version for __float128.  */
   iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_real128")), ".wW",
+	get_identifier (PREFIX("transfer_real128")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_REAL128_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_real128_write")), ".wR",
+	get_identifier (PREFIX("transfer_real128_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_complex128")), ".wW",
+	get_identifier (PREFIX("transfer_complex128")), ".wW.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_COMPLEX128_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_complex128_write")), ".wR",
+	get_identifier (PREFIX("transfer_complex128_write")), ".wR.",
 	void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
 
   iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_array")), ".ww",
+	get_identifier (PREFIX("transfer_array")), ".ww..",
 	void_type_node, 4, dt_parm_type, pvoid_type_node,
 	integer_type_node, gfc_charlen_type_node);
 
   iocall[IOCALL_X_ARRAY_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_array_write")), ".wr",
+	get_identifier (PREFIX("transfer_array_write")), ".wr..",
 	void_type_node, 4, dt_parm_type, pvoid_type_node,
 	integer_type_node, gfc_charlen_type_node);
 
   iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("transfer_derived")), ".wrR",
-	void_type_node, 2, dt_parm_type, pvoid_type_node, pchar_type_node);
+	get_identifier (PREFIX("transfer_derived")), ".wr",
+	void_type_node, 2, dt_parm_type, pvoid_type_node);
 
   /* Library entry points */
 
@@ -475,18 +475,18 @@  gfc_build_io_library_fndecls (void)
 	void_type_node, 1, dt_parm_type);
 
   iocall[IOCALL_SET_NML_VAL] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_set_nml_var")), ".w.R",
+	get_identifier (PREFIX("st_set_nml_var")), ".w.R...",
 	void_type_node, 6, dt_parm_type, pvoid_type_node, pvoid_type_node,
 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node());
 
   iocall[IOCALL_SET_NML_DTIO_VAL] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R",
+	get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R.....",
 	void_type_node, 8, dt_parm_type, pvoid_type_node, pvoid_type_node,
 	gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node(),
 	pvoid_type_node, pvoid_type_node);
 
   iocall[IOCALL_SET_NML_VAL_DIM] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_set_nml_var_dim")), ".w",
+	get_identifier (PREFIX("st_set_nml_var_dim")), ".w....",
 	void_type_node, 5, dt_parm_type, gfc_int4_type_node,
 	gfc_array_index_type, gfc_array_index_type, gfc_array_index_type);
 }