diff mbox series

Perforate fnspec attribute strings

Message ID 20201002132137.GC70943@kam.mff.cuni.cz
State New
Headers show
Series Perforate fnspec attribute strings | expand

Commit Message

Jan Hubicka Oct. 2, 2020, 1:21 p.m. UTC
Hi,
as discussed this patch makes return value and arg specifiers to be 2
characters long and updates (I hope) all fnspec strings.
I also enabled part of the verification (just accepting the fortran bug
with 'R' and 'W' in return value specifiers) to get some evidence that
the update is complete.

Bootstrapped/regtested x86_64-linux, OK?

gcc/ChangeLog:

2020-10-02  Jan Hubicka  <hubicka@ucw.cz>

	* attr-fnspec.h: Update documentation.
	(attr_fnsec::return_desc_size): Set to 2
	(attr_fnsec::arg_desc_size): Set to 2
	* builtin-attrs.def (STR1): Update fnspec.
	* internal-fn.def (UBSAN_NULL): Update fnspec.
	(UBSAN_VPTR): Update fnspec.
	(UBSAN_PTR): Update fnspec.
	(ASAN_CHECK): Update fnspec.
	(GOACC_DIM_SIZE): Remove fnspec.
	(GOACC_DIM_POS): Remove fnspec.
	* tree-ssa-alias.c (attr_fnspec::verify): Update verification.

gcc/fortran/ChangeLog:

2020-10-02  Jan Hubicka  <hubicka@ucw.cz>

	* trans-decl.c (gfc_build_library_function_decl_with_spec): Verify
	fnspec.
	(gfc_build_intrinsic_function_decls): Update fnspecs.
	(gfc_build_builtin_function_decls): Update fnspecs.
	* trans-io.c (gfc_build_io_library_fndecls): Update fnspecs.
	* trans-types.c (create_fn_spec): Update fnspecs.

Comments

Richard Biener Oct. 2, 2020, 1:52 p.m. UTC | #1
On Fri, 2 Oct 2020, Jan Hubicka wrote:

> Hi,
> as discussed this patch makes return value and arg specifiers to be 2
> characters long and updates (I hope) all fnspec strings.
> I also enabled part of the verification (just accepting the fortran bug
> with 'R' and 'W' in return value specifiers) to get some evidence that
> the update is complete.
> 
> Bootstrapped/regtested x86_64-linux, OK?

OK.

Richard.

> gcc/ChangeLog:
> 
> 2020-10-02  Jan Hubicka  <hubicka@ucw.cz>
> 
> 	* attr-fnspec.h: Update documentation.
> 	(attr_fnsec::return_desc_size): Set to 2
> 	(attr_fnsec::arg_desc_size): Set to 2
> 	* builtin-attrs.def (STR1): Update fnspec.
> 	* internal-fn.def (UBSAN_NULL): Update fnspec.
> 	(UBSAN_VPTR): Update fnspec.
> 	(UBSAN_PTR): Update fnspec.
> 	(ASAN_CHECK): Update fnspec.
> 	(GOACC_DIM_SIZE): Remove fnspec.
> 	(GOACC_DIM_POS): Remove fnspec.
> 	* tree-ssa-alias.c (attr_fnspec::verify): Update verification.
> 
> gcc/fortran/ChangeLog:
> 
> 2020-10-02  Jan Hubicka  <hubicka@ucw.cz>
> 
> 	* trans-decl.c (gfc_build_library_function_decl_with_spec): Verify
> 	fnspec.
> 	(gfc_build_intrinsic_function_decls): Update fnspecs.
> 	(gfc_build_builtin_function_decls): Update fnspecs.
> 	* trans-io.c (gfc_build_io_library_fndecls): Update fnspecs.
> 	* trans-types.c (create_fn_spec): Update fnspecs.
> 
> 
> diff --git a/gcc/attr-fnspec.h b/gcc/attr-fnspec.h
> index 607c0cf0f54..921bb48ae6a 100644
> --- a/gcc/attr-fnspec.h
> +++ b/gcc/attr-fnspec.h
> @@ -25,15 +25,22 @@
>       '1'...'4'  specifies number of argument function returns (as in memset)
>       'm'	specifies that returned value is noalias (as in malloc)
>       '.'	specifies that nothing is known.
> +   character 1  specifies additional function properties
> +     ' '        specifies that nothing is known
>  
> -   character 1+i specifies properties of argument number i as follows:
> +   character 2+2i specifies properties of argument number i as follows:
>       'x' or 'X' specifies that parameter is unused.
>       'r' or 'R' specifies that parameter is only read and memory pointed to is
>  		never dereferenced.
>       'w' or 'W' specifies that parameter is only written to.
>       '.'	specifies that nothing is known.
>     The uppercase letter in addition specifies that parameter
> -   is non-escaping.  */
> +   is non-escaping. 
> +
> +   character 3+2i specifies additional properties of argument number i
> +   as follows:
> +     ' '        nothing is known
> + */
>  
>  #ifndef ATTR_FNSPEC_H
>  #define ATTR_FNSPEC_H
> @@ -46,9 +53,9 @@ private:
>    /* length of the fn spec string.  */
>    const unsigned len;
>    /* Number of characters specifying return value.  */
> -  const unsigned int return_desc_size = 1;
> +  const unsigned int return_desc_size = 2;
>    /* Number of characters specifying size.  */
> -  const unsigned int arg_desc_size = 1;
> +  const unsigned int arg_desc_size = 2;
>  
>    /* Return start of specifier of arg i.  */
>    unsigned int arg_idx (int i)
> diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
> index 3239311b5a4..778bc8a43a1 100644
> --- a/gcc/builtin-attrs.def
> +++ b/gcc/builtin-attrs.def
> @@ -66,7 +66,7 @@ DEF_ATTR_FOR_INT (6)
>    DEF_ATTR_STRING (ATTR_##ENUM, VALUE)			\
>    DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL,	\
>  		      ATTR_##ENUM, ATTR_NULL)
> -DEF_ATTR_FOR_STRING (STR1, "1")
> +DEF_ATTR_FOR_STRING (STR1, "1 ")
>  #undef DEF_ATTR_FOR_STRING
>  
>  /* Construct a tree for a list of two integers.  */
> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
> index 2be9df40d2c..5940a1fd10c 100644
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "gomp-constants.h"
>  #include "gimplify.h"
>  #include "omp-general.h"
> +#include "attr-fnspec.h"
>  
>  #define MAX_LABEL_VALUE 99999
>  
> @@ -3306,6 +3307,11 @@ gfc_build_library_function_decl_with_spec (tree name, const char *spec,
>    tree ret;
>    va_list args;
>    va_start (args, nargs);
> +  if (flag_checking)
> +    {
> +      attr_fnspec fnspec (spec, strlen (spec));
> +      fnspec.verify ();
> +    }
>    ret = build_library_function_decl_1 (name, spec, rettype, nargs, args);
>    va_end (args);
>    return ret;
> @@ -3325,144 +3331,144 @@ gfc_build_intrinsic_function_decls (void)
>  
>    /* String functions.  */
>    gfor_fndecl_compare_string = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("compare_string")), "..R.R",
> +	get_identifier (PREFIX("compare_string")), ". . R . R ",
>  	integer_type_node, 4, gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node);
>    DECL_PURE_P (gfor_fndecl_compare_string) = 1;
>    TREE_NOTHROW (gfor_fndecl_compare_string) = 1;
>  
>    gfor_fndecl_concat_string = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("concat_string")), "..W.R.R",
> +	get_identifier (PREFIX("concat_string")), ". . W . R . R ",
>  	void_type_node, 6, gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node);
>    TREE_NOTHROW (gfor_fndecl_concat_string) = 1;
>  
>    gfor_fndecl_string_len_trim = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_len_trim")), "..R",
> +	get_identifier (PREFIX("string_len_trim")), ". . R ",
>  	gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar1_type_node);
>    DECL_PURE_P (gfor_fndecl_string_len_trim) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_len_trim) = 1;
>  
>    gfor_fndecl_string_index = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_index")), "..R.R.",
> +	get_identifier (PREFIX("string_index")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_index) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_index) = 1;
>  
>    gfor_fndecl_string_scan = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_scan")), "..R.R.",
> +	get_identifier (PREFIX("string_scan")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_scan) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_scan) = 1;
>  
>    gfor_fndecl_string_verify = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_verify")), "..R.R.",
> +	get_identifier (PREFIX("string_verify")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
>  	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_verify) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_verify) = 1;
>  
>    gfor_fndecl_string_trim = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_trim")), ".Ww.R",
> +	get_identifier (PREFIX("string_trim")), ". W w . R ",
>  	void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
>  	build_pointer_type (pchar1_type_node), gfc_charlen_type_node,
>  	pchar1_type_node);
>  
>    gfor_fndecl_string_minmax = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_minmax")), ".Ww.R",
> +	get_identifier (PREFIX("string_minmax")), ". W w . R ",
>  	void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
>  	build_pointer_type (pchar1_type_node), integer_type_node,
>  	integer_type_node);
>  
>    gfor_fndecl_adjustl = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("adjustl")), ".W.R",
> +	get_identifier (PREFIX("adjustl")), ". W . R ",
>  	void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
>  	pchar1_type_node);
>    TREE_NOTHROW (gfor_fndecl_adjustl) = 1;
>  
>    gfor_fndecl_adjustr = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("adjustr")), ".W.R",
> +	get_identifier (PREFIX("adjustr")), ". W . R ",
>  	void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
>  	pchar1_type_node);
>    TREE_NOTHROW (gfor_fndecl_adjustr) = 1;
>  
>    gfor_fndecl_select_string =  gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("select_string")), ".R.R.",
> +	get_identifier (PREFIX("select_string")), ". R . R . ",
>  	integer_type_node, 4, pvoid_type_node, integer_type_node,
>  	pchar1_type_node, gfc_charlen_type_node);
>    DECL_PURE_P (gfor_fndecl_select_string) = 1;
>    TREE_NOTHROW (gfor_fndecl_select_string) = 1;
>  
>    gfor_fndecl_compare_string_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("compare_string_char4")), "..R.R",
> +	get_identifier (PREFIX("compare_string_char4")), ". . R . R ",
>  	integer_type_node, 4, gfc_charlen_type_node, pchar4_type_node,
>  	gfc_charlen_type_node, pchar4_type_node);
>    DECL_PURE_P (gfor_fndecl_compare_string_char4) = 1;
>    TREE_NOTHROW (gfor_fndecl_compare_string_char4) = 1;
>  
>    gfor_fndecl_concat_string_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("concat_string_char4")), "..W.R.R",
> +	get_identifier (PREFIX("concat_string_char4")), ". . W . R . R ",
>  	void_type_node, 6, gfc_charlen_type_node, pchar4_type_node,
>  	gfc_charlen_type_node, pchar4_type_node, gfc_charlen_type_node,
>  	pchar4_type_node);
>    TREE_NOTHROW (gfor_fndecl_concat_string_char4) = 1;
>  
>    gfor_fndecl_string_len_trim_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_len_trim_char4")), "..R",
> +	get_identifier (PREFIX("string_len_trim_char4")), ". . R ",
>  	gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_len_trim_char4) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_len_trim_char4) = 1;
>  
>    gfor_fndecl_string_index_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_index_char4")), "..R.R.",
> +	get_identifier (PREFIX("string_index_char4")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
>  	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_index_char4) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_index_char4) = 1;
>  
>    gfor_fndecl_string_scan_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_scan_char4")), "..R.R.",
> +	get_identifier (PREFIX("string_scan_char4")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
>  	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_scan_char4) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_scan_char4) = 1;
>  
>    gfor_fndecl_string_verify_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_verify_char4")), "..R.R.",
> +	get_identifier (PREFIX("string_verify_char4")), ". . R . R . ",
>  	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
>  	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
>    DECL_PURE_P (gfor_fndecl_string_verify_char4) = 1;
>    TREE_NOTHROW (gfor_fndecl_string_verify_char4) = 1;
>  
>    gfor_fndecl_string_trim_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_trim_char4")), ".Ww.R",
> +	get_identifier (PREFIX("string_trim_char4")), ". W w . R ",
>  	void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
>  	build_pointer_type (pchar4_type_node), gfc_charlen_type_node,
>  	pchar4_type_node);
>  
>    gfor_fndecl_string_minmax_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("string_minmax_char4")), ".Ww.R",
> +	get_identifier (PREFIX("string_minmax_char4")), ". W w . R ",
>  	void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
>  	build_pointer_type (pchar4_type_node), integer_type_node,
>  	integer_type_node);
>  
>    gfor_fndecl_adjustl_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("adjustl_char4")), ".W.R",
> +	get_identifier (PREFIX("adjustl_char4")), ". W . R ",
>  	void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
>  	pchar4_type_node);
>    TREE_NOTHROW (gfor_fndecl_adjustl_char4) = 1;
>  
>    gfor_fndecl_adjustr_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("adjustr_char4")), ".W.R",
> +	get_identifier (PREFIX("adjustr_char4")), ". W . R ",
>  	void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
>  	pchar4_type_node);
>    TREE_NOTHROW (gfor_fndecl_adjustr_char4) = 1;
>  
>    gfor_fndecl_select_string_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("select_string_char4")), ".R.R.",
> +	get_identifier (PREFIX("select_string_char4")), ". R . R . ",
>  	integer_type_node, 4, pvoid_type_node, integer_type_node,
>  	pvoid_type_node, gfc_charlen_type_node);
>    DECL_PURE_P (gfor_fndecl_select_string_char4) = 1;
> @@ -3472,28 +3478,28 @@ gfc_build_intrinsic_function_decls (void)
>    /* Conversion between character kinds.  */
>  
>    gfor_fndecl_convert_char1_to_char4 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("convert_char1_to_char4")), ".w.R",
> +	get_identifier (PREFIX("convert_char1_to_char4")), ". w . R ",
>  	void_type_node, 3, build_pointer_type (pchar4_type_node),
>  	gfc_charlen_type_node, pchar1_type_node);
>  
>    gfor_fndecl_convert_char4_to_char1 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("convert_char4_to_char1")), ".w.R",
> +	get_identifier (PREFIX("convert_char4_to_char1")), ". w . R ",
>  	void_type_node, 3, build_pointer_type (pchar1_type_node),
>  	gfc_charlen_type_node, pchar4_type_node);
>  
>    /* 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);
>  
> @@ -3503,19 +3509,19 @@ gfc_build_intrinsic_function_decls (void)
>  	gfc_int4_type_node);
>  
>    gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("selected_char_kind")), "..R",
> +	get_identifier (PREFIX("selected_char_kind")), ". . R ",
>  	gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node);
>    DECL_PURE_P (gfor_fndecl_sc_kind) = 1;
>    TREE_NOTHROW (gfor_fndecl_sc_kind) = 1;
>  
>    gfor_fndecl_si_kind = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("selected_int_kind")), ".R",
> +	get_identifier (PREFIX("selected_int_kind")), ". R ",
>  	gfc_int4_type_node, 1, pvoid_type_node);
>    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",
> +	get_identifier (PREFIX("selected_real_kind2008")), ". R R ",
>  	gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
>  	pvoid_type_node);
>    DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
> @@ -3656,13 +3662,13 @@ gfc_build_intrinsic_function_decls (void)
>  
>    /* Other functions.  */
>    gfor_fndecl_size0 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("size0")), ".R",
> +	get_identifier (PREFIX("size0")), ". R ",
>  	gfc_array_index_type, 1, pvoid_type_node);
>    DECL_PURE_P (gfor_fndecl_size0) = 1;
>    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;
> @@ -3680,7 +3686,7 @@ gfc_build_intrinsic_function_decls (void)
>  	2, gfc_int4_type_node, gfc_int4_type_node);
>  
>    gfor_fndecl_is_contiguous0 = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("is_contiguous0")), ".R",
> +	get_identifier (PREFIX("is_contiguous0")), ". R ",
>  	gfc_int4_type_node, 1, pvoid_type_node);
>    DECL_PURE_P (gfor_fndecl_is_contiguous0) = 1;
>    TREE_NOTHROW (gfor_fndecl_is_contiguous0) = 1;
> @@ -3701,7 +3707,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 +3720,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.  */
> @@ -3725,32 +3731,32 @@ gfc_build_builtin_function_decls (void)
>  	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.",
> +	get_identifier (PREFIX("pause_string")), ". R . ",
>  	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",
> +	get_identifier (PREFIX("runtime_error")), ". R ",
>  	void_type_node, -1, pchar_type_node);
>    /* The runtime_error function does not return.  */
>    TREE_THIS_VOLATILE (gfor_fndecl_runtime_error) = 1;
>  
>    gfor_fndecl_runtime_error_at = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("runtime_error_at")), ".RR",
> +	get_identifier (PREFIX("runtime_error_at")), ". R R ",
>  	void_type_node, -2, pchar_type_node, pchar_type_node);
>    /* The runtime_error_at function does not return.  */
>    TREE_THIS_VOLATILE (gfor_fndecl_runtime_error_at) = 1;
>  
>    gfor_fndecl_runtime_warning_at = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("runtime_warning_at")), ".RR",
> +	get_identifier (PREFIX("runtime_warning_at")), ". R R ",
>  	void_type_node, -2, pchar_type_node, pchar_type_node);
>  
>    gfor_fndecl_generate_error = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("generate_error")), ".R.R",
> +	get_identifier (PREFIX("generate_error")), ". R . R ",
>  	void_type_node, 3, pvoid_type_node, integer_type_node,
>  	pchar_type_node);
>  
>    gfor_fndecl_os_error_at = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("os_error_at")), ".RR",
> +	get_identifier (PREFIX("os_error_at")), ". R R ",
>  	void_type_node, -2, pchar_type_node, pchar_type_node);
>    /* The os_error_at function does not return.  */
>    TREE_THIS_VOLATILE (gfor_fndecl_os_error_at) = 1;
> @@ -3774,7 +3780,7 @@ gfc_build_builtin_function_decls (void)
>  
>    /* Keep the array dimension in sync with the call, later in this file.  */
>    gfor_fndecl_set_options = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("set_options")), "..R",
> +	get_identifier (PREFIX("set_options")), ". . R ",
>  	void_type_node, 2, integer_type_node,
>  	build_pointer_type (integer_type_node));
>  
> @@ -3791,11 +3797,11 @@ gfc_build_builtin_function_decls (void)
>  	void_type_node, 1, integer_type_node);
>  
>    gfor_fndecl_in_pack = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("internal_pack")), ".r",
> +	get_identifier (PREFIX("internal_pack")), ". r ",
>  	pvoid_type_node, 1, pvoid_type_node);
>  
>    gfor_fndecl_in_unpack = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("internal_unpack")), ".wR",
> +	get_identifier (PREFIX("internal_unpack")), ". w R ",
>  	void_type_node, 2, pvoid_type_node, pvoid_type_node);
>  
>    /* These two builtins write into what the first argument points to and
> @@ -3804,15 +3810,15 @@ gfc_build_builtin_function_decls (void)
>       which is copied into the descriptor pointed by the first argument,
>       effectively escaping that way.  See PR92123.  */
>    gfor_fndecl_cfi_to_gfc = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ".w.",
> +	get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ". w . ",
>  	void_type_node, 2, pvoid_type_node, ppvoid_type_node);
>  
>    gfor_fndecl_gfc_to_cfi = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ".w.",
> +	get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ". w . ",
>  	void_type_node, 2, ppvoid_type_node, pvoid_type_node);
>  
>    gfor_fndecl_associated = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("associated")), ".RR",
> +	get_identifier (PREFIX("associated")), ". R R ",
>  	integer_type_node, 2, ppvoid_type_node, ppvoid_type_node);
>    DECL_PURE_P (gfor_fndecl_associated) = 1;
>    TREE_NOTHROW (gfor_fndecl_associated) = 1;
> @@ -3842,49 +3848,55 @@ gfc_build_builtin_function_decls (void)
>  	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,
> +	get_identifier (PREFIX("caf_register")), "R R W W W W R ",
> +	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 R W W R ",
> +	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,
> +	get_identifier (PREFIX("caf_get")), ". R . R R W R R R W ",
> +	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,
> +	get_identifier (PREFIX("caf_send")), ". R . R R R R R R W R ",
> +	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",
> +	get_identifier (PREFIX("caf_sendget")), ". R . R R R R . R R R R R R ",
>  	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,
> +	get_identifier (PREFIX("caf_get_by_ref")), ". R W R R R R R W R ",
> +	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",
> +	get_identifier (PREFIX("caf_send_by_ref")), ". R R R R R R R W R ",
>  	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",
> +	    get_identifier (PREFIX("caf_sendget_by_ref")),
> +	    ". R R . R R R R R W W R R ",
>  	    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 +3904,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")), ". W W . ", 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")), ". W W . ", 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")), "..RWW.", void_type_node,
> +	get_identifier (PREFIX("caf_sync_images")), ". . R W W . ", void_type_node,
>  	5, integer_type_node, pint_type, pint_type,
>  	pchar_type_node, size_type_node);
>  
> @@ -3911,7 +3923,7 @@ gfc_build_builtin_function_decls (void)
>        TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop) = 1;
>  
>        gfor_fndecl_caf_error_stop_str = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_error_stop_str")), ".R.",
> +	get_identifier (PREFIX("caf_error_stop_str")), ". R . ",
>  	void_type_node, 2, pchar_type_node, size_type_node);
>        /* CAF's ERROR STOP doesn't return.  */
>        TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop_str) = 1;
> @@ -3923,55 +3935,55 @@ gfc_build_builtin_function_decls (void)
>        TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_numeric) = 1;
>  
>        gfor_fndecl_caf_stop_str = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_stop_str")), ".R.",
> +	get_identifier (PREFIX("caf_stop_str")), ". R . ",
>  	void_type_node, 2, pchar_type_node, size_type_node);
>        /* CAF's STOP doesn't return.  */
>        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 . . R W ",
>  	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 . . W W ",
>  	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 . . W R R W ",
>  	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 . . R W W ",
>  	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 . . W W W ",
>  	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 . . W W ",
>  	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 . . W W ",
>  	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 . . W W ",
>  	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 . . W W ",
>  	void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node,
>  	pint_type, pint_type);
>  
> @@ -3982,19 +3994,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")), "W R R ",
>  	    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")), "R W R ",
>  	    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 R ",
>  	    void_type_node, 2, ppvoid_type_node,
>  	    integer_type_node);
>  
> @@ -4009,43 +4021,43 @@ gfc_build_builtin_function_decls (void)
>  
>        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 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",
> +	    get_identifier (PREFIX("caf_team_number")), "R ",
>        	    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 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")), "W R R ",
>  	    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 . W W ",
>  	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 . W W ",
>  	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 . W W ",
>  	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 . W W ",
>  	void_type_node, 8, pvoid_type_node,
>  	build_pointer_type (build_varargs_function_type_list (void_type_node,
>  							      NULL_TREE)),
> @@ -4053,12 +4065,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 . W W ",
>  	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 R ",
>  	integer_type_node, 3, pvoid_type_node, integer_type_node,
>  	pvoid_type_node);
>      }
> diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
> index 363cca51ef9..666dc370959 100644
> --- a/gcc/fortran/trans-io.c
> +++ b/gcc/fortran/trans-io.c
> @@ -328,165 +328,165 @@ 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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . . ",
>  	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")), ". w R . . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w W . ",
>  	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")), ". w R . ",
>  	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")), ". w w . . ",
>  	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")), ". w r . . ",
>  	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")), ".wr",
> +	get_identifier (PREFIX("transfer_derived")), ". w r ",
>  	void_type_node, 2, dt_parm_type, pvoid_type_node);
>  
>    /* Library entry points */
>  
>    iocall[IOCALL_READ] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_read")), ".w",
> +	get_identifier (PREFIX("st_read")), ". w ",
>  	void_type_node, 1, dt_parm_type);
>  
>    iocall[IOCALL_WRITE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_write")), ".w",
> +	get_identifier (PREFIX("st_write")), ". w ",
>  	void_type_node, 1, dt_parm_type);
>  
>    parm_type = build_pointer_type (st_parameter[IOPARM_ptype_open].type);
>    iocall[IOCALL_OPEN] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_open")), ".w",
> +	get_identifier (PREFIX("st_open")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    parm_type = build_pointer_type (st_parameter[IOPARM_ptype_close].type);
>    iocall[IOCALL_CLOSE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_close")), ".w",
> +	get_identifier (PREFIX("st_close")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    parm_type = build_pointer_type (st_parameter[IOPARM_ptype_inquire].type);
>    iocall[IOCALL_INQUIRE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_inquire")), ".w",
> +	get_identifier (PREFIX("st_inquire")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    iocall[IOCALL_IOLENGTH] = gfc_build_library_function_decl_with_spec(
> -	get_identifier (PREFIX("st_iolength")), ".w",
> +	get_identifier (PREFIX("st_iolength")), ". w ",
>  	void_type_node, 1, dt_parm_type);
>  
>    parm_type = build_pointer_type (st_parameter[IOPARM_ptype_wait].type);
>    iocall[IOCALL_WAIT] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_wait_async")), ".w",
> +	get_identifier (PREFIX("st_wait_async")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    parm_type = build_pointer_type (st_parameter[IOPARM_ptype_filepos].type);
>    iocall[IOCALL_REWIND] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_rewind")), ".w",
> +	get_identifier (PREFIX("st_rewind")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    iocall[IOCALL_BACKSPACE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_backspace")), ".w",
> +	get_identifier (PREFIX("st_backspace")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    iocall[IOCALL_ENDFILE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_endfile")), ".w",
> +	get_identifier (PREFIX("st_endfile")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    iocall[IOCALL_FLUSH] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_flush")), ".w",
> +	get_identifier (PREFIX("st_flush")), ". w ",
>  	void_type_node, 1, parm_type);
>  
>    /* Library helpers */
>  
>    iocall[IOCALL_READ_DONE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_read_done")), ".w",
> +	get_identifier (PREFIX("st_read_done")), ". w ",
>  	void_type_node, 1, dt_parm_type);
>  
>    iocall[IOCALL_WRITE_DONE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_write_done")), ".w",
> +	get_identifier (PREFIX("st_write_done")), ". w ",
>  	void_type_node, 1, dt_parm_type);
>  
>    iocall[IOCALL_IOLENGTH_DONE] = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("st_iolength_done")), ".w",
> +	get_identifier (PREFIX("st_iolength_done")), ". w ",
>  	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 --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
> index 26fdb2803a7..17f3ccc1d4e 100644
> --- a/gcc/fortran/trans-types.c
> +++ b/gcc/fortran/trans-types.c
> @@ -2940,20 +2940,33 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
>  
>    memset (&spec, 0, sizeof (spec));
>    spec[0] = '.';
> -  spec_len = 1;
> +  spec[1] = ' ';
> +  spec_len = 2;
>  
>    if (sym->attr.entry_master)
> -    spec[spec_len++] = 'R';
> +    {
> +      spec[spec_len++] = 'R';
> +      spec[spec_len++] = ' ';
> +    }
>    if (gfc_return_by_reference (sym))
>      {
>        gfc_symbol *result = sym->result ? sym->result : sym;
>  
>        if (result->attr.pointer || sym->attr.proc_pointer)
> -	spec[spec_len++] = '.';
> +	{
> +	  spec[spec_len++] = '.';
> +	  spec[spec_len++] = ' ';
> +	}
>        else
> -	spec[spec_len++] = 'w';
> +	{
> +	  spec[spec_len++] = 'w';
> +	  spec[spec_len++] = ' ';
> +	}
>        if (sym->ts.type == BT_CHARACTER)
> -	spec[spec_len++] = 'R';
> +	{
> +	  spec[spec_len++] = 'R';
> +	  spec[spec_len++] = ' ';
> +	}
>      }
>  
>    for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
> @@ -2968,11 +2981,20 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
>  		&& (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp
>  		    || CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))
>  	    || (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop))
> -	  spec[spec_len++] = '.';
> +	  {
> +	    spec[spec_len++] = '.';
> +	    spec[spec_len++] = ' ';
> +	  }
>  	else if (f->sym->attr.intent == INTENT_IN)
> -	  spec[spec_len++] = 'r';
> +	  {
> +	    spec[spec_len++] = 'r';
> +	    spec[spec_len++] = ' ';
> +	  }
>  	else if (f->sym)
> -	  spec[spec_len++] = 'w';
> +	  {
> +	    spec[spec_len++] = 'w';
> +	    spec[spec_len++] = ' ';
> +	  }
>        }
>  
>    tmp = build_tree_list (NULL_TREE, build_string (spec_len, spec));
> diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
> index e6cfe1b6159..310d37aa538 100644
> --- a/gcc/internal-fn.def
> +++ b/gcc/internal-fn.def
> @@ -311,17 +311,18 @@ DEF_INTERNAL_FN (GOMP_SIMD_ORDERED_END, ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (LOOP_DIST_ALIAS, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (ANNOTATE,  ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> -DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ".R.")
> +DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ". R . ")
>  DEF_INTERNAL_FN (UBSAN_BOUNDS, ECF_LEAF | ECF_NOTHROW, NULL)
> -DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ".RR..")
> +DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ". R R . . ")
>  DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> -DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.")
> +DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ". R . ")
>  DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
>  DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
> -DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, "..R..")
> +DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW,
> +		 ". . R . . ")
>  DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, NULL)
>  DEF_INTERNAL_FN (ASAN_POISON, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
>  DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
> @@ -345,8 +346,8 @@ DEF_INTERNAL_FN (PHI, 0, NULL)
>     thought to clobber memory and can be gcse'd within a single
>     parallel region, but not across FORK/JOIN boundaries.  They take a
>     single INTEGER_CST argument.  This might be overly conservative.  */
> -DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, ".")
> -DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, ".")
> +DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, NULL)
> +DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, NULL)
>  
>  /* OpenACC looping abstraction.  See internal-fn.h for usage.  */
>  DEF_INTERNAL_FN (GOACC_LOOP, ECF_PURE | ECF_NOTHROW, NULL)
> diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
> index 52aeaebf476..3d3a91cfd46 100644
> --- a/gcc/tree-ssa-alias.c
> +++ b/gcc/tree-ssa-alias.c
> @@ -4020,16 +4020,21 @@ walk_aliased_vdefs (ao_ref *ref, tree vdef,
>  void
>  attr_fnspec::verify ()
>  {
> -  /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec strings.
> -     re-enable verification after these are fixed.  */
> -  return;
>    bool err = false;
>  
>    /* Check return value specifier.  */
>    if (len < return_desc_size)
>      err = true;
> +  else if ((len - return_desc_size) % arg_desc_size)
> +    err = true;
>    else if ((str[0] < '1' || str[0] > '4')
> -	   && str[0] != '.' && str[0] != 'm')
> +	   && str[0] != '.' && str[0] != 'm'
> +	   /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec
> +	      strings.  The following characters have no meaning.  */
> +	   && str[0] != 'R' && str[0] != 'W')
> +    err = true;
> +
> +  if (str[1] != ' ')
>      err = true;
>  
>    /* Now check all parameters.  */
> @@ -4049,7 +4054,9 @@ attr_fnspec::verify ()
>  	  default:
>  	    err = true;
>  	}
> +      if (str[idx + 1] != ' ')
> +	err = true;
>      }
>    if (err)
> -    internal_error ("invalid fn spec attribute %s", str);
> +    internal_error ("invalid fn spec attribute \"%s\"", str);
>  }
> diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
> index 1ada1fecb58..7bf5d28eb46 100644
> --- a/libgcc/libgcov-util.c
> +++ b/libgcc/libgcov-util.c
> @@ -690,8 +690,8 @@ gcov_profile_merge (struct gcov_info *tgt_profile, struct gcov_info *src_profile
>      tgt_cnt++;
>    for (gi_ptr = src_profile; gi_ptr; gi_ptr = gi_ptr->next)
>      src_cnt++;
> -  tgt_infos = (struct gcov_info **) xmalloc (sizeof (struct gcov_info *)
> -                 * tgt_cnt);
> +  tgt_infos = (struct gcov_info **) xcalloc (sizeof (struct gcov_info *)
> +                 * tgt_cnt, 1);
>    gcc_assert (tgt_infos);
>    in_src_not_tgt = (struct gcov_info **) xmalloc (sizeof (struct gcov_info *)
>                       * src_cnt);
>
diff mbox series

Patch

diff --git a/gcc/attr-fnspec.h b/gcc/attr-fnspec.h
index 607c0cf0f54..921bb48ae6a 100644
--- a/gcc/attr-fnspec.h
+++ b/gcc/attr-fnspec.h
@@ -25,15 +25,22 @@ 
      '1'...'4'  specifies number of argument function returns (as in memset)
      'm'	specifies that returned value is noalias (as in malloc)
      '.'	specifies that nothing is known.
+   character 1  specifies additional function properties
+     ' '        specifies that nothing is known
 
-   character 1+i specifies properties of argument number i as follows:
+   character 2+2i specifies properties of argument number i as follows:
      'x' or 'X' specifies that parameter is unused.
      'r' or 'R' specifies that parameter is only read and memory pointed to is
 		never dereferenced.
      'w' or 'W' specifies that parameter is only written to.
      '.'	specifies that nothing is known.
    The uppercase letter in addition specifies that parameter
-   is non-escaping.  */
+   is non-escaping. 
+
+   character 3+2i specifies additional properties of argument number i
+   as follows:
+     ' '        nothing is known
+ */
 
 #ifndef ATTR_FNSPEC_H
 #define ATTR_FNSPEC_H
@@ -46,9 +53,9 @@  private:
   /* length of the fn spec string.  */
   const unsigned len;
   /* Number of characters specifying return value.  */
-  const unsigned int return_desc_size = 1;
+  const unsigned int return_desc_size = 2;
   /* Number of characters specifying size.  */
-  const unsigned int arg_desc_size = 1;
+  const unsigned int arg_desc_size = 2;
 
   /* Return start of specifier of arg i.  */
   unsigned int arg_idx (int i)
diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
index 3239311b5a4..778bc8a43a1 100644
--- a/gcc/builtin-attrs.def
+++ b/gcc/builtin-attrs.def
@@ -66,7 +66,7 @@  DEF_ATTR_FOR_INT (6)
   DEF_ATTR_STRING (ATTR_##ENUM, VALUE)			\
   DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL,	\
 		      ATTR_##ENUM, ATTR_NULL)
-DEF_ATTR_FOR_STRING (STR1, "1")
+DEF_ATTR_FOR_STRING (STR1, "1 ")
 #undef DEF_ATTR_FOR_STRING
 
 /* Construct a tree for a list of two integers.  */
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 2be9df40d2c..5940a1fd10c 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -48,6 +48,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gomp-constants.h"
 #include "gimplify.h"
 #include "omp-general.h"
+#include "attr-fnspec.h"
 
 #define MAX_LABEL_VALUE 99999
 
@@ -3306,6 +3307,11 @@  gfc_build_library_function_decl_with_spec (tree name, const char *spec,
   tree ret;
   va_list args;
   va_start (args, nargs);
+  if (flag_checking)
+    {
+      attr_fnspec fnspec (spec, strlen (spec));
+      fnspec.verify ();
+    }
   ret = build_library_function_decl_1 (name, spec, rettype, nargs, args);
   va_end (args);
   return ret;
@@ -3325,144 +3331,144 @@  gfc_build_intrinsic_function_decls (void)
 
   /* String functions.  */
   gfor_fndecl_compare_string = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("compare_string")), "..R.R",
+	get_identifier (PREFIX("compare_string")), ". . R . R ",
 	integer_type_node, 4, gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node);
   DECL_PURE_P (gfor_fndecl_compare_string) = 1;
   TREE_NOTHROW (gfor_fndecl_compare_string) = 1;
 
   gfor_fndecl_concat_string = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("concat_string")), "..W.R.R",
+	get_identifier (PREFIX("concat_string")), ". . W . R . R ",
 	void_type_node, 6, gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node);
   TREE_NOTHROW (gfor_fndecl_concat_string) = 1;
 
   gfor_fndecl_string_len_trim = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_len_trim")), "..R",
+	get_identifier (PREFIX("string_len_trim")), ". . R ",
 	gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar1_type_node);
   DECL_PURE_P (gfor_fndecl_string_len_trim) = 1;
   TREE_NOTHROW (gfor_fndecl_string_len_trim) = 1;
 
   gfor_fndecl_string_index = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_index")), "..R.R.",
+	get_identifier (PREFIX("string_index")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_index) = 1;
   TREE_NOTHROW (gfor_fndecl_string_index) = 1;
 
   gfor_fndecl_string_scan = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_scan")), "..R.R.",
+	get_identifier (PREFIX("string_scan")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_scan) = 1;
   TREE_NOTHROW (gfor_fndecl_string_scan) = 1;
 
   gfor_fndecl_string_verify = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_verify")), "..R.R.",
+	get_identifier (PREFIX("string_verify")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
 	gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_verify) = 1;
   TREE_NOTHROW (gfor_fndecl_string_verify) = 1;
 
   gfor_fndecl_string_trim = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_trim")), ".Ww.R",
+	get_identifier (PREFIX("string_trim")), ". W w . R ",
 	void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
 	build_pointer_type (pchar1_type_node), gfc_charlen_type_node,
 	pchar1_type_node);
 
   gfor_fndecl_string_minmax = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_minmax")), ".Ww.R",
+	get_identifier (PREFIX("string_minmax")), ". W w . R ",
 	void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
 	build_pointer_type (pchar1_type_node), integer_type_node,
 	integer_type_node);
 
   gfor_fndecl_adjustl = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("adjustl")), ".W.R",
+	get_identifier (PREFIX("adjustl")), ". W . R ",
 	void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
 	pchar1_type_node);
   TREE_NOTHROW (gfor_fndecl_adjustl) = 1;
 
   gfor_fndecl_adjustr = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("adjustr")), ".W.R",
+	get_identifier (PREFIX("adjustr")), ". W . R ",
 	void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
 	pchar1_type_node);
   TREE_NOTHROW (gfor_fndecl_adjustr) = 1;
 
   gfor_fndecl_select_string =  gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("select_string")), ".R.R.",
+	get_identifier (PREFIX("select_string")), ". R . R . ",
 	integer_type_node, 4, pvoid_type_node, integer_type_node,
 	pchar1_type_node, gfc_charlen_type_node);
   DECL_PURE_P (gfor_fndecl_select_string) = 1;
   TREE_NOTHROW (gfor_fndecl_select_string) = 1;
 
   gfor_fndecl_compare_string_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("compare_string_char4")), "..R.R",
+	get_identifier (PREFIX("compare_string_char4")), ". . R . R ",
 	integer_type_node, 4, gfc_charlen_type_node, pchar4_type_node,
 	gfc_charlen_type_node, pchar4_type_node);
   DECL_PURE_P (gfor_fndecl_compare_string_char4) = 1;
   TREE_NOTHROW (gfor_fndecl_compare_string_char4) = 1;
 
   gfor_fndecl_concat_string_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("concat_string_char4")), "..W.R.R",
+	get_identifier (PREFIX("concat_string_char4")), ". . W . R . R ",
 	void_type_node, 6, gfc_charlen_type_node, pchar4_type_node,
 	gfc_charlen_type_node, pchar4_type_node, gfc_charlen_type_node,
 	pchar4_type_node);
   TREE_NOTHROW (gfor_fndecl_concat_string_char4) = 1;
 
   gfor_fndecl_string_len_trim_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_len_trim_char4")), "..R",
+	get_identifier (PREFIX("string_len_trim_char4")), ". . R ",
 	gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar4_type_node);
   DECL_PURE_P (gfor_fndecl_string_len_trim_char4) = 1;
   TREE_NOTHROW (gfor_fndecl_string_len_trim_char4) = 1;
 
   gfor_fndecl_string_index_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_index_char4")), "..R.R.",
+	get_identifier (PREFIX("string_index_char4")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
 	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_index_char4) = 1;
   TREE_NOTHROW (gfor_fndecl_string_index_char4) = 1;
 
   gfor_fndecl_string_scan_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_scan_char4")), "..R.R.",
+	get_identifier (PREFIX("string_scan_char4")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
 	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_scan_char4) = 1;
   TREE_NOTHROW (gfor_fndecl_string_scan_char4) = 1;
 
   gfor_fndecl_string_verify_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_verify_char4")), "..R.R.",
+	get_identifier (PREFIX("string_verify_char4")), ". . R . R . ",
 	gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
 	gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
   DECL_PURE_P (gfor_fndecl_string_verify_char4) = 1;
   TREE_NOTHROW (gfor_fndecl_string_verify_char4) = 1;
 
   gfor_fndecl_string_trim_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_trim_char4")), ".Ww.R",
+	get_identifier (PREFIX("string_trim_char4")), ". W w . R ",
 	void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
 	build_pointer_type (pchar4_type_node), gfc_charlen_type_node,
 	pchar4_type_node);
 
   gfor_fndecl_string_minmax_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("string_minmax_char4")), ".Ww.R",
+	get_identifier (PREFIX("string_minmax_char4")), ". W w . R ",
 	void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
 	build_pointer_type (pchar4_type_node), integer_type_node,
 	integer_type_node);
 
   gfor_fndecl_adjustl_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("adjustl_char4")), ".W.R",
+	get_identifier (PREFIX("adjustl_char4")), ". W . R ",
 	void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
 	pchar4_type_node);
   TREE_NOTHROW (gfor_fndecl_adjustl_char4) = 1;
 
   gfor_fndecl_adjustr_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("adjustr_char4")), ".W.R",
+	get_identifier (PREFIX("adjustr_char4")), ". W . R ",
 	void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
 	pchar4_type_node);
   TREE_NOTHROW (gfor_fndecl_adjustr_char4) = 1;
 
   gfor_fndecl_select_string_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("select_string_char4")), ".R.R.",
+	get_identifier (PREFIX("select_string_char4")), ". R . R . ",
 	integer_type_node, 4, pvoid_type_node, integer_type_node,
 	pvoid_type_node, gfc_charlen_type_node);
   DECL_PURE_P (gfor_fndecl_select_string_char4) = 1;
@@ -3472,28 +3478,28 @@  gfc_build_intrinsic_function_decls (void)
   /* Conversion between character kinds.  */
 
   gfor_fndecl_convert_char1_to_char4 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("convert_char1_to_char4")), ".w.R",
+	get_identifier (PREFIX("convert_char1_to_char4")), ". w . R ",
 	void_type_node, 3, build_pointer_type (pchar4_type_node),
 	gfc_charlen_type_node, pchar1_type_node);
 
   gfor_fndecl_convert_char4_to_char1 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("convert_char4_to_char1")), ".w.R",
+	get_identifier (PREFIX("convert_char4_to_char1")), ". w . R ",
 	void_type_node, 3, build_pointer_type (pchar1_type_node),
 	gfc_charlen_type_node, pchar4_type_node);
 
   /* 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);
 
@@ -3503,19 +3509,19 @@  gfc_build_intrinsic_function_decls (void)
 	gfc_int4_type_node);
 
   gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("selected_char_kind")), "..R",
+	get_identifier (PREFIX("selected_char_kind")), ". . R ",
 	gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node);
   DECL_PURE_P (gfor_fndecl_sc_kind) = 1;
   TREE_NOTHROW (gfor_fndecl_sc_kind) = 1;
 
   gfor_fndecl_si_kind = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("selected_int_kind")), ".R",
+	get_identifier (PREFIX("selected_int_kind")), ". R ",
 	gfc_int4_type_node, 1, pvoid_type_node);
   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",
+	get_identifier (PREFIX("selected_real_kind2008")), ". R R ",
 	gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
 	pvoid_type_node);
   DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
@@ -3656,13 +3662,13 @@  gfc_build_intrinsic_function_decls (void)
 
   /* Other functions.  */
   gfor_fndecl_size0 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("size0")), ".R",
+	get_identifier (PREFIX("size0")), ". R ",
 	gfc_array_index_type, 1, pvoid_type_node);
   DECL_PURE_P (gfor_fndecl_size0) = 1;
   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;
@@ -3680,7 +3686,7 @@  gfc_build_intrinsic_function_decls (void)
 	2, gfc_int4_type_node, gfc_int4_type_node);
 
   gfor_fndecl_is_contiguous0 = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("is_contiguous0")), ".R",
+	get_identifier (PREFIX("is_contiguous0")), ". R ",
 	gfc_int4_type_node, 1, pvoid_type_node);
   DECL_PURE_P (gfor_fndecl_is_contiguous0) = 1;
   TREE_NOTHROW (gfor_fndecl_is_contiguous0) = 1;
@@ -3701,7 +3707,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 +3720,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.  */
@@ -3725,32 +3731,32 @@  gfc_build_builtin_function_decls (void)
 	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.",
+	get_identifier (PREFIX("pause_string")), ". R . ",
 	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",
+	get_identifier (PREFIX("runtime_error")), ". R ",
 	void_type_node, -1, pchar_type_node);
   /* The runtime_error function does not return.  */
   TREE_THIS_VOLATILE (gfor_fndecl_runtime_error) = 1;
 
   gfor_fndecl_runtime_error_at = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("runtime_error_at")), ".RR",
+	get_identifier (PREFIX("runtime_error_at")), ". R R ",
 	void_type_node, -2, pchar_type_node, pchar_type_node);
   /* The runtime_error_at function does not return.  */
   TREE_THIS_VOLATILE (gfor_fndecl_runtime_error_at) = 1;
 
   gfor_fndecl_runtime_warning_at = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("runtime_warning_at")), ".RR",
+	get_identifier (PREFIX("runtime_warning_at")), ". R R ",
 	void_type_node, -2, pchar_type_node, pchar_type_node);
 
   gfor_fndecl_generate_error = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("generate_error")), ".R.R",
+	get_identifier (PREFIX("generate_error")), ". R . R ",
 	void_type_node, 3, pvoid_type_node, integer_type_node,
 	pchar_type_node);
 
   gfor_fndecl_os_error_at = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("os_error_at")), ".RR",
+	get_identifier (PREFIX("os_error_at")), ". R R ",
 	void_type_node, -2, pchar_type_node, pchar_type_node);
   /* The os_error_at function does not return.  */
   TREE_THIS_VOLATILE (gfor_fndecl_os_error_at) = 1;
@@ -3774,7 +3780,7 @@  gfc_build_builtin_function_decls (void)
 
   /* Keep the array dimension in sync with the call, later in this file.  */
   gfor_fndecl_set_options = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("set_options")), "..R",
+	get_identifier (PREFIX("set_options")), ". . R ",
 	void_type_node, 2, integer_type_node,
 	build_pointer_type (integer_type_node));
 
@@ -3791,11 +3797,11 @@  gfc_build_builtin_function_decls (void)
 	void_type_node, 1, integer_type_node);
 
   gfor_fndecl_in_pack = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("internal_pack")), ".r",
+	get_identifier (PREFIX("internal_pack")), ". r ",
 	pvoid_type_node, 1, pvoid_type_node);
 
   gfor_fndecl_in_unpack = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("internal_unpack")), ".wR",
+	get_identifier (PREFIX("internal_unpack")), ". w R ",
 	void_type_node, 2, pvoid_type_node, pvoid_type_node);
 
   /* These two builtins write into what the first argument points to and
@@ -3804,15 +3810,15 @@  gfc_build_builtin_function_decls (void)
      which is copied into the descriptor pointed by the first argument,
      effectively escaping that way.  See PR92123.  */
   gfor_fndecl_cfi_to_gfc = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ".w.",
+	get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ". w . ",
 	void_type_node, 2, pvoid_type_node, ppvoid_type_node);
 
   gfor_fndecl_gfc_to_cfi = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ".w.",
+	get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ". w . ",
 	void_type_node, 2, ppvoid_type_node, pvoid_type_node);
 
   gfor_fndecl_associated = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("associated")), ".RR",
+	get_identifier (PREFIX("associated")), ". R R ",
 	integer_type_node, 2, ppvoid_type_node, ppvoid_type_node);
   DECL_PURE_P (gfor_fndecl_associated) = 1;
   TREE_NOTHROW (gfor_fndecl_associated) = 1;
@@ -3842,49 +3848,55 @@  gfc_build_builtin_function_decls (void)
 	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,
+	get_identifier (PREFIX("caf_register")), "R R W W W W R ",
+	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 R W W R ",
+	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,
+	get_identifier (PREFIX("caf_get")), ". R . R R W R R R W ",
+	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,
+	get_identifier (PREFIX("caf_send")), ". R . R R R R R R W R ",
+	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",
+	get_identifier (PREFIX("caf_sendget")), ". R . R R R R . R R R R R R ",
 	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,
+	get_identifier (PREFIX("caf_get_by_ref")), ". R W R R R R R W R ",
+	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",
+	get_identifier (PREFIX("caf_send_by_ref")), ". R R R R R R R W R ",
 	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",
+	    get_identifier (PREFIX("caf_sendget_by_ref")),
+	    ". R R . R R R R R W W R R ",
 	    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 +3904,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")), ". W W . ", 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")), ". W W . ", 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")), "..RWW.", void_type_node,
+	get_identifier (PREFIX("caf_sync_images")), ". . R W W . ", void_type_node,
 	5, integer_type_node, pint_type, pint_type,
 	pchar_type_node, size_type_node);
 
@@ -3911,7 +3923,7 @@  gfc_build_builtin_function_decls (void)
       TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop) = 1;
 
       gfor_fndecl_caf_error_stop_str = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_error_stop_str")), ".R.",
+	get_identifier (PREFIX("caf_error_stop_str")), ". R . ",
 	void_type_node, 2, pchar_type_node, size_type_node);
       /* CAF's ERROR STOP doesn't return.  */
       TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop_str) = 1;
@@ -3923,55 +3935,55 @@  gfc_build_builtin_function_decls (void)
       TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_numeric) = 1;
 
       gfor_fndecl_caf_stop_str = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_stop_str")), ".R.",
+	get_identifier (PREFIX("caf_stop_str")), ". R . ",
 	void_type_node, 2, pchar_type_node, size_type_node);
       /* CAF's STOP doesn't return.  */
       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 . . R W ",
 	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 . . W W ",
 	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 . . W R R W ",
 	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 . . R W W ",
 	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 . . W W W ",
 	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 . . W W ",
 	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 . . W W ",
 	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 . . W W ",
 	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 . . W W ",
 	void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pint_type);
 
@@ -3982,19 +3994,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")), "W R R ",
 	    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")), "R W R ",
 	    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 R ",
 	    void_type_node, 2, ppvoid_type_node,
 	    integer_type_node);
 
@@ -4009,43 +4021,43 @@  gfc_build_builtin_function_decls (void)
 
       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 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",
+	    get_identifier (PREFIX("caf_team_number")), "R ",
       	    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 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")), "W R R ",
 	    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 . W W ",
 	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 . W W ",
 	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 . W W ",
 	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 . W W ",
 	void_type_node, 8, pvoid_type_node,
 	build_pointer_type (build_varargs_function_type_list (void_type_node,
 							      NULL_TREE)),
@@ -4053,12 +4065,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 . W W ",
 	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 R ",
 	integer_type_node, 3, pvoid_type_node, integer_type_node,
 	pvoid_type_node);
     }
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 363cca51ef9..666dc370959 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -328,165 +328,165 @@  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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . . ",
 	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")), ". w R . . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w W . ",
 	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")), ". w R . ",
 	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")), ". w w . . ",
 	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")), ". w r . . ",
 	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")), ".wr",
+	get_identifier (PREFIX("transfer_derived")), ". w r ",
 	void_type_node, 2, dt_parm_type, pvoid_type_node);
 
   /* Library entry points */
 
   iocall[IOCALL_READ] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_read")), ".w",
+	get_identifier (PREFIX("st_read")), ". w ",
 	void_type_node, 1, dt_parm_type);
 
   iocall[IOCALL_WRITE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_write")), ".w",
+	get_identifier (PREFIX("st_write")), ". w ",
 	void_type_node, 1, dt_parm_type);
 
   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_open].type);
   iocall[IOCALL_OPEN] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_open")), ".w",
+	get_identifier (PREFIX("st_open")), ". w ",
 	void_type_node, 1, parm_type);
 
   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_close].type);
   iocall[IOCALL_CLOSE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_close")), ".w",
+	get_identifier (PREFIX("st_close")), ". w ",
 	void_type_node, 1, parm_type);
 
   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_inquire].type);
   iocall[IOCALL_INQUIRE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_inquire")), ".w",
+	get_identifier (PREFIX("st_inquire")), ". w ",
 	void_type_node, 1, parm_type);
 
   iocall[IOCALL_IOLENGTH] = gfc_build_library_function_decl_with_spec(
-	get_identifier (PREFIX("st_iolength")), ".w",
+	get_identifier (PREFIX("st_iolength")), ". w ",
 	void_type_node, 1, dt_parm_type);
 
   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_wait].type);
   iocall[IOCALL_WAIT] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_wait_async")), ".w",
+	get_identifier (PREFIX("st_wait_async")), ". w ",
 	void_type_node, 1, parm_type);
 
   parm_type = build_pointer_type (st_parameter[IOPARM_ptype_filepos].type);
   iocall[IOCALL_REWIND] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_rewind")), ".w",
+	get_identifier (PREFIX("st_rewind")), ". w ",
 	void_type_node, 1, parm_type);
 
   iocall[IOCALL_BACKSPACE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_backspace")), ".w",
+	get_identifier (PREFIX("st_backspace")), ". w ",
 	void_type_node, 1, parm_type);
 
   iocall[IOCALL_ENDFILE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_endfile")), ".w",
+	get_identifier (PREFIX("st_endfile")), ". w ",
 	void_type_node, 1, parm_type);
 
   iocall[IOCALL_FLUSH] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_flush")), ".w",
+	get_identifier (PREFIX("st_flush")), ". w ",
 	void_type_node, 1, parm_type);
 
   /* Library helpers */
 
   iocall[IOCALL_READ_DONE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_read_done")), ".w",
+	get_identifier (PREFIX("st_read_done")), ". w ",
 	void_type_node, 1, dt_parm_type);
 
   iocall[IOCALL_WRITE_DONE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_write_done")), ".w",
+	get_identifier (PREFIX("st_write_done")), ". w ",
 	void_type_node, 1, dt_parm_type);
 
   iocall[IOCALL_IOLENGTH_DONE] = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("st_iolength_done")), ".w",
+	get_identifier (PREFIX("st_iolength_done")), ". w ",
 	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 --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 26fdb2803a7..17f3ccc1d4e 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2940,20 +2940,33 @@  create_fn_spec (gfc_symbol *sym, tree fntype)
 
   memset (&spec, 0, sizeof (spec));
   spec[0] = '.';
-  spec_len = 1;
+  spec[1] = ' ';
+  spec_len = 2;
 
   if (sym->attr.entry_master)
-    spec[spec_len++] = 'R';
+    {
+      spec[spec_len++] = 'R';
+      spec[spec_len++] = ' ';
+    }
   if (gfc_return_by_reference (sym))
     {
       gfc_symbol *result = sym->result ? sym->result : sym;
 
       if (result->attr.pointer || sym->attr.proc_pointer)
-	spec[spec_len++] = '.';
+	{
+	  spec[spec_len++] = '.';
+	  spec[spec_len++] = ' ';
+	}
       else
-	spec[spec_len++] = 'w';
+	{
+	  spec[spec_len++] = 'w';
+	  spec[spec_len++] = ' ';
+	}
       if (sym->ts.type == BT_CHARACTER)
-	spec[spec_len++] = 'R';
+	{
+	  spec[spec_len++] = 'R';
+	  spec[spec_len++] = ' ';
+	}
     }
 
   for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
@@ -2968,11 +2981,20 @@  create_fn_spec (gfc_symbol *sym, tree fntype)
 		&& (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp
 		    || CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))
 	    || (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop))
-	  spec[spec_len++] = '.';
+	  {
+	    spec[spec_len++] = '.';
+	    spec[spec_len++] = ' ';
+	  }
 	else if (f->sym->attr.intent == INTENT_IN)
-	  spec[spec_len++] = 'r';
+	  {
+	    spec[spec_len++] = 'r';
+	    spec[spec_len++] = ' ';
+	  }
 	else if (f->sym)
-	  spec[spec_len++] = 'w';
+	  {
+	    spec[spec_len++] = 'w';
+	    spec[spec_len++] = ' ';
+	  }
       }
 
   tmp = build_tree_list (NULL_TREE, build_string (spec_len, spec));
diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
index e6cfe1b6159..310d37aa538 100644
--- a/gcc/internal-fn.def
+++ b/gcc/internal-fn.def
@@ -311,17 +311,18 @@  DEF_INTERNAL_FN (GOMP_SIMD_ORDERED_END, ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (LOOP_DIST_ALIAS, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (ANNOTATE,  ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ".R.")
+DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ". R . ")
 DEF_INTERNAL_FN (UBSAN_BOUNDS, ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ".RR..")
+DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ". R R . . ")
 DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.")
+DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ". R . ")
 DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
 DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, "..R..")
+DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW,
+		 ". . R . . ")
 DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, NULL)
 DEF_INTERNAL_FN (ASAN_POISON, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
 DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
@@ -345,8 +346,8 @@  DEF_INTERNAL_FN (PHI, 0, NULL)
    thought to clobber memory and can be gcse'd within a single
    parallel region, but not across FORK/JOIN boundaries.  They take a
    single INTEGER_CST argument.  This might be overly conservative.  */
-DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, ".")
-DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, ".")
+DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, NULL)
+DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, NULL)
 
 /* OpenACC looping abstraction.  See internal-fn.h for usage.  */
 DEF_INTERNAL_FN (GOACC_LOOP, ECF_PURE | ECF_NOTHROW, NULL)
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 52aeaebf476..3d3a91cfd46 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -4020,16 +4020,21 @@  walk_aliased_vdefs (ao_ref *ref, tree vdef,
 void
 attr_fnspec::verify ()
 {
-  /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec strings.
-     re-enable verification after these are fixed.  */
-  return;
   bool err = false;
 
   /* Check return value specifier.  */
   if (len < return_desc_size)
     err = true;
+  else if ((len - return_desc_size) % arg_desc_size)
+    err = true;
   else if ((str[0] < '1' || str[0] > '4')
-	   && str[0] != '.' && str[0] != 'm')
+	   && str[0] != '.' && str[0] != 'm'
+	   /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec
+	      strings.  The following characters have no meaning.  */
+	   && str[0] != 'R' && str[0] != 'W')
+    err = true;
+
+  if (str[1] != ' ')
     err = true;
 
   /* Now check all parameters.  */
@@ -4049,7 +4054,9 @@  attr_fnspec::verify ()
 	  default:
 	    err = true;
 	}
+      if (str[idx + 1] != ' ')
+	err = true;
     }
   if (err)
-    internal_error ("invalid fn spec attribute %s", str);
+    internal_error ("invalid fn spec attribute \"%s\"", str);
 }
diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
index 1ada1fecb58..7bf5d28eb46 100644
--- a/libgcc/libgcov-util.c
+++ b/libgcc/libgcov-util.c
@@ -690,8 +690,8 @@  gcov_profile_merge (struct gcov_info *tgt_profile, struct gcov_info *src_profile
     tgt_cnt++;
   for (gi_ptr = src_profile; gi_ptr; gi_ptr = gi_ptr->next)
     src_cnt++;
-  tgt_infos = (struct gcov_info **) xmalloc (sizeof (struct gcov_info *)
-                 * tgt_cnt);
+  tgt_infos = (struct gcov_info **) xcalloc (sizeof (struct gcov_info *)
+                 * tgt_cnt, 1);
   gcc_assert (tgt_infos);
   in_src_not_tgt = (struct gcov_info **) xmalloc (sizeof (struct gcov_info *)
                      * src_cnt);