diff mbox series

libgfortran caf API help needed: Fixing fnspec strings in trans-decl

Message ID 20200930161231.GA36960@kam.mff.cuni.cz
State New
Headers show
Series libgfortran caf API help needed: Fixing fnspec strings in trans-decl | expand

Commit Message

Jan Hubicka Sept. 30, 2020, 4:12 p.m. UTC
Hi,
this patch contains basic fixup of the fnspec strings for caf, however I
am quite sure I need help on this (short of dropping them all).

I first assumed that we have missing "." for return values since most
strings had as many letters as parametrs, but it is not true.
I tried to check the strings with reality. For example:


void                                                                            
_gfortran_caf_co_sum (gfc_descriptor_t *a __attribute__ ((unused)),             
                      int result_image __attribute__ ((unused)),                
                      int *stat, char *errmsg __attribute__ ((unused)),         
                      size_t errmsg_len __attribute__ ((unused)))               
{                                                                               
  if (stat)                                                                     
    *stat = 0;                                                                  
}                                                                               

Should have fnspec
 ".XXWXX"
First dot represents return value, then X is for unused parameters and W
is for stat pointer we write into.

However I am not sure why the pointers are part ofthe API, if they are
meant to be used later, we need to specify them so things remain ABI
compatible.

It is declared as:
	get_identifier (PREFIX("caf_co_sum")), "W.WW",
Which correclty specifies stat as W, but I am not sure what does the
else.

I would apprechiate help from someone who knows the API to correct the
strings.  Basicaly all strings starting with "W" or "R" are wrong since
they miss the return value specifier.

An alternative would be to simply drop all of those if we are unsure
what they do, but it seems lame.

Honza

Comments

Tobias Burnus Sept. 30, 2020, 5:12 p.m. UTC | #1
Hi Honza,

On 9/30/20 6:12 PM, Jan Hubicka wrote:
> _gfortran_caf_co_sum (gfc_descriptor_t *a __attribute__ ((unused)),
>
> Should have fnspec
>   ".XXWXX"
> First dot represents return value, then X is for unused parameters

'X' is definitely wrong. In GCC there is only a stub implementation for
gfortran's coarray (Fortran) implemented. The full version needs
a communication library – such as MPI (Message Passing Interface)
or GASNet or OpenShMem ... Hence, that library is separate. The main point
of this stub library is to provide some means for testing.

See http://www.opencoarrays.org/ and
https://github.com/sourceryinstitute/opencoarrays/
for a (or rather: the) version which actually implements those
library functions.

> I would apprechiate help from someone who knows the API to correct the
> strings.

@Andre? How about you? ;-)

> -  gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
> -     get_identifier (PREFIX("selected_real_kind2008")), ".RR",
> +  gfor_fndecl_sr_kind = gfc_build_library_function_decl (
> +     get_identifier (PREFIX("selected_real_kind2008")),

(This one is outside CAF.)

@Honza: I want to note that also for user functions, 'fn spec' are
generated, cf. create_fn_spec in trans-types.c – hopefully this one is fine.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Andre Vehreschild Sept. 30, 2020, 5:59 p.m. UTC | #2
Hi Honza, Tobias,
Yes, I am willing to help and will do so as soon as my small vacation ends
on Monday.

Regards,
Andre

Andre Vehreschild * vehre@gmx.de
Am 30. September 2020 19:12:48 schrieb Tobias Burnus <tobias@codesourcery.com>:

> Hi Honza,
>
> On 9/30/20 6:12 PM, Jan Hubicka wrote:
>> _gfortran_caf_co_sum (gfc_descriptor_t *a __attribute__ ((unused)),
>>
>> Should have fnspec
>>   ".XXWXX"
>> First dot represents return value, then X is for unused parameters
>
> 'X' is definitely wrong. In GCC there is only a stub implementation for
> gfortran's coarray (Fortran) implemented. The full version needs
> a communication library – such as MPI (Message Passing Interface)
> or GASNet or OpenShMem ... Hence, that library is separate. The main point
> of this stub library is to provide some means for testing.
>
> See http://www.opencoarrays.org/ and
> https://github.com/sourceryinstitute/opencoarrays/
> for a (or rather: the) version which actually implements those
> library functions.
>
>> I would apprechiate help from someone who knows the API to correct the
>> strings.
>
> @Andre? How about you? ;-)
>
>> -  gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
>> -     get_identifier (PREFIX("selected_real_kind2008")), ".RR",
>> +  gfor_fndecl_sr_kind = gfc_build_library_function_decl (
>> +     get_identifier (PREFIX("selected_real_kind2008")),
>
> (This one is outside CAF.)
>
> @Honza: I want to note that also for user functions, 'fn spec' are
> generated, cf. create_fn_spec in trans-types.c – hopefully this one is fine.
>
> Tobias
>
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> Alexander Walter
Andre Vehreschild Oct. 7, 2020, 10:21 a.m. UTC | #3
Hi,

I am confused. Given that on 2. Oct. 2020 you committed changes to the
caf-fn_spec strings means: you don't need anymore help on this?

- Andre

On Wed, 30 Sep 2020 18:12:31 +0200
Jan Hubicka <hubicka@ucw.cz> wrote:

> Hi,
> this patch contains basic fixup of the fnspec strings for caf, however I
> am quite sure I need help on this (short of dropping them all).
>
> I first assumed that we have missing "." for return values since most
> strings had as many letters as parametrs, but it is not true.
> I tried to check the strings with reality. For example:
>
>
> void
> _gfortran_caf_co_sum (gfc_descriptor_t *a __attribute__ ((unused)),
> int result_image __attribute__ ((unused)),
>                       int *stat, char *errmsg __attribute__ ((unused)),
> size_t errmsg_len __attribute__ ((unused)))
> {
> if (stat)
>     *stat = 0;
> }
>
>
> Should have fnspec
>  ".XXWXX"
> First dot represents return value, then X is for unused parameters and W
> is for stat pointer we write into.
>
> However I am not sure why the pointers are part ofthe API, if they are
> meant to be used later, we need to specify them so things remain ABI
> compatible.
>
> It is declared as:
> 	get_identifier (PREFIX("caf_co_sum")), "W.WW",
> Which correclty specifies stat as W, but I am not sure what does the
> else.
>
> I would apprechiate help from someone who knows the API to correct the
> strings.  Basicaly all strings starting with "W" or "R" are wrong since
> they miss the return value specifier.
>
> An alternative would be to simply drop all of those if we are unsure
> what they do, but it seems lame.
>
> Honza
>
> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
> index 2be9df40d2c..59ea891915e 100644
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -3514,8 +3514,8 @@ gfc_build_intrinsic_function_decls (void)
>    DECL_PURE_P (gfor_fndecl_si_kind) = 1;
>    TREE_NOTHROW (gfor_fndecl_si_kind) = 1;
>
> -  gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("selected_real_kind2008")), ".RR",
> +  gfor_fndecl_sr_kind = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("selected_real_kind2008")),
>  	gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
>  	pvoid_type_node);
>    DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
> @@ -3841,50 +3841,50 @@ gfc_build_builtin_function_decls (void)
>  	get_identifier (PREFIX("caf_num_images")), integer_type_node,
>  	2, integer_type_node, integer_type_node);
>
> -      gfor_fndecl_caf_register = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_register")), "RRWWWWR", void_type_node,
> 7,
> +      gfor_fndecl_caf_register = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_register")), void_type_node, 7,
>  	size_type_node, integer_type_node, ppvoid_type_node, pvoid_type_node,
>  	pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node,
> 5,
> +	get_identifier (PREFIX("caf_deregister")), ".W.WW.", void_type_node,
> 5, ppvoid_type_node, integer_type_node, pint_type, pchar_type_node,
>  	size_type_node);
>
> -      gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10,
> +      gfor_fndecl_caf_get = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_get")), void_type_node, 10,
>  	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
>  	pvoid_type_node, pvoid_type_node, integer_type_node,
> integer_type_node, boolean_type_node, pint_type);
>
> -      gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_send")), ".R.RRRRRRWR", void_type_node,
> 11,
> +      gfor_fndecl_caf_send = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_send")), void_type_node, 11,
>  	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
>  	pvoid_type_node, pvoid_type_node, integer_type_node,
> integer_type_node, boolean_type_node, pint_type, pvoid_type_node);
>
> -      gfor_fndecl_caf_sendget = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_sendget")), ".R.RRRR.RRRRRR",
> +      gfor_fndecl_caf_sendget = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_sendget")),
>  	void_type_node,	14, pvoid_type_node, size_type_node,
> integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node,
> size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node,
> integer_type_node, integer_type_node, boolean_type_node, integer_type_node);
>
> -      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_get_by_ref")), ".RWRRRRRWR",
> void_type_node,
> +      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_get_by_ref")), void_type_node,
>  	10, pvoid_type_node, integer_type_node, pvoid_type_node,
>  	pvoid_type_node, integer_type_node, integer_type_node,
>  	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
>
> -      gfor_fndecl_caf_send_by_ref =
> gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_send_by_ref")), ".RRRRRRRWR",
> +      gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl (
> +	get_identifier (PREFIX("caf_send_by_ref")),
>  	void_type_node,	10, pvoid_type_node, integer_type_node,
> pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
>  	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
>
>        gfor_fndecl_caf_sendget_by_ref
> -	  = gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_sendget_by_ref")), ".RR.RRRRRWWRR",
> +	  = gfc_build_library_function_decl (
> +	    get_identifier (PREFIX("caf_sendget_by_ref")),
>  	    void_type_node, 13, pvoid_type_node, integer_type_node,
>  	    pvoid_type_node, pvoid_type_node, integer_type_node,
>  	    pvoid_type_node, integer_type_node, integer_type_node,
> @@ -3900,7 +3900,7 @@ gfc_build_builtin_function_decls (void)
>  	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")), "..RRW.", void_type_node,
>  	5, integer_type_node, pint_type, pint_type,
>  	pchar_type_node, size_type_node);
>
> @@ -3929,49 +3929,49 @@ gfc_build_builtin_function_decls (void)
>        TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_str) = 1;
>
>        gfor_fndecl_caf_atomic_def = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_atomic_define")), "R..RW",
> +	get_identifier (PREFIX("caf_atomic_define")), ".R..RW..",
>  	void_type_node, 7, pvoid_type_node, size_type_node,
> integer_type_node, pvoid_type_node, pint_type, integer_type_node,
> integer_type_node);
>        gfor_fndecl_caf_atomic_ref = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_atomic_ref")), "R..WW",
> +	get_identifier (PREFIX("caf_atomic_ref")), ".R..WW..",
>  	void_type_node, 7, pvoid_type_node, size_type_node,
> integer_type_node, pvoid_type_node, pint_type, integer_type_node,
> integer_type_node);
>        gfor_fndecl_caf_atomic_cas = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_atomic_cas")), "R..WRRW",
> +	get_identifier (PREFIX("caf_atomic_cas")), ".R..WRRW..",
>  	void_type_node, 9, pvoid_type_node, size_type_node,
> integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node,
> pint_type, integer_type_node, integer_type_node);
>
>        gfor_fndecl_caf_atomic_op = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_atomic_op")), ".R..RWW",
> +	get_identifier (PREFIX("caf_atomic_op")), "..R..RWW..",
>  	void_type_node, 9, integer_type_node, pvoid_type_node,
> size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node,
> pint_type, integer_type_node, integer_type_node);
>
>        gfor_fndecl_caf_lock = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_lock")), "R..WWW",
> +	get_identifier (PREFIX("caf_lock")), ".R..WWW.",
>  	void_type_node, 7, pvoid_type_node, size_type_node,
> integer_type_node, pint_type, pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_unlock = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_unlock")), "R..WW",
> +	get_identifier (PREFIX("caf_unlock")), ".R..WW.",
>  	void_type_node, 6, pvoid_type_node, size_type_node,
> integer_type_node, pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_event_post = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_event_post")), "R..WW",
> +	get_identifier (PREFIX("caf_event_post")), ".R..WW.",
>  	void_type_node, 6, pvoid_type_node, size_type_node,
> integer_type_node, pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_event_wait = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_event_wait")), "R..WW",
> +	get_identifier (PREFIX("caf_event_wait")), ".R..WW.",
>  	void_type_node, 6, pvoid_type_node, size_type_node,
> integer_type_node, pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_event_query =
> gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_event_query")), "R..WW",
> +	get_identifier (PREFIX("caf_event_query")), ".R..WW",
>  	void_type_node, 5, pvoid_type_node, size_type_node,
> integer_type_node, pint_type, pint_type);
>
> @@ -3982,19 +3982,19 @@ gfc_build_builtin_function_decls (void)
>
>        gfor_fndecl_caf_failed_images
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_failed_images")), "WRR",
> +	    get_identifier (PREFIX("caf_failed_images")), ".WR.",
>  	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
>  	    integer_type_node);
>
>        gfor_fndecl_caf_form_team
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_form_team")), "RWR",
> +	    get_identifier (PREFIX("caf_form_team")), ".RW.",
>  	    void_type_node, 3, integer_type_node, ppvoid_type_node,
>  	    integer_type_node);
>
>        gfor_fndecl_caf_change_team
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_change_team")), "RR",
> +	    get_identifier (PREFIX("caf_change_team")), ".R.",
>  	    void_type_node, 2, ppvoid_type_node,
>  	    integer_type_node);
>
> @@ -4009,43 +4009,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.",
>  	    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",
> -      	    integer_type_node, 1, integer_type_node);
> +	= gfc_build_library_function_decl (
> +	    get_identifier (PREFIX("caf_team_number")),
> +	    integer_type_node, 1, integer_type_node);
>
>        gfor_fndecl_caf_image_status
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_image_status")), "RR",
> +	    get_identifier (PREFIX("caf_image_status")), "..R",
>  	    integer_type_node, 2, integer_type_node, ppvoid_type_node);
>
>        gfor_fndecl_caf_stopped_images
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_stopped_images")), "WRR",
> +	    get_identifier (PREFIX("caf_stopped_images")), ".WR.",
>  	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
>  	    integer_type_node);
>
>        gfor_fndecl_co_broadcast = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_co_broadcast")), "W.WW",
> +	get_identifier (PREFIX("caf_co_broadcast")), ".W.WW.",
>  	void_type_node, 5, pvoid_type_node, integer_type_node,
>  	pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_co_max = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_co_max")), "W.WW",
> +	get_identifier (PREFIX("caf_co_max")), ".W.WW..",
>  	void_type_node, 6, pvoid_type_node, integer_type_node,
>  	pint_type, pchar_type_node, integer_type_node, size_type_node);
>
>        gfor_fndecl_co_min = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_co_min")), "W.WW",
> +	get_identifier (PREFIX("caf_co_min")), ".W.WW..",
>  	void_type_node, 6, pvoid_type_node, integer_type_node,
>  	pint_type, pchar_type_node, integer_type_node, size_type_node);
>
>        gfor_fndecl_co_reduce = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_co_reduce")), "W.R.WW",
> +	get_identifier (PREFIX("caf_co_reduce")), ".W.R.WW..",
>  	void_type_node, 8, pvoid_type_node,
>  	build_pointer_type (build_varargs_function_type_list (void_type_node,
>  							      NULL_TREE)),
> @@ -4053,12 +4053,12 @@ gfc_build_builtin_function_decls (void)
>  	integer_type_node, size_type_node);
>
>        gfor_fndecl_co_sum = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_co_sum")), "W.WW",
> +	get_identifier (PREFIX("caf_co_sum")), ".W.WW.",
>  	void_type_node, 5, pvoid_type_node, integer_type_node,
>  	pint_type, pchar_type_node, size_type_node);
>
>        gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec
> (
> -	get_identifier (PREFIX("caf_is_present")), "RRR",
> +	get_identifier (PREFIX("caf_is_present")), ".R.R",
>  	integer_type_node, 3, pvoid_type_node, integer_type_node,
>  	pvoid_type_node);
>      }


--
Andre Vehreschild * Email: vehre ad gmx dot de
Tobias Burnus Oct. 7, 2020, 11:28 a.m. UTC | #4
Hi Andre,

On 10/7/20 12:21 PM, Andre Vehreschild wrote:
> I am confused. Given that on 2. Oct. 2020 you committed changes to the
> caf-fn_spec strings means: you don't need anymore help on this?

Do you mean the change by the patch "Perforate fnspec attribute strings"?
(https://gcc.gnu.org/g:762cca0023c9bdbd762c44f33a954845bbccd568)
That one just added spaces for the updated fnspec format.

Otherwise:
See gcc/attr-fnspec.h for a description.

I suggest also to have a look at the commit log at
https://gcc.gnu.org/g:2595f25cdaf4f16d04a1078a487b2ecc126cae29
and at the PR https://gcc.gnu.org/PR92123 for gotchas.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Andre Vehreschild Oct. 15, 2020, 12:43 p.m. UTC | #5
Hi Honza,

attached is the patch to fix the fnspec-strings for the caf-api. I have tested
it and got no regressions with gcc-testsuite and with the opencoarray's
testsuite. So that seems fine. Hope this helps and again thank you for your
instant support on IRC.

Regards,
	Andre

On Wed, 7 Oct 2020 13:28:56 +0200
Tobias Burnus <tobias@codesourcery.com> wrote:

> Hi Andre,
> 
> On 10/7/20 12:21 PM, Andre Vehreschild wrote:
> > I am confused. Given that on 2. Oct. 2020 you committed changes to the
> > caf-fn_spec strings means: you don't need anymore help on this?  
> 
> Do you mean the change by the patch "Perforate fnspec attribute strings"?
> (https://gcc.gnu.org/g:762cca0023c9bdbd762c44f33a954845bbccd568)
> That one just added spaces for the updated fnspec format.
> 
> Otherwise:
> See gcc/attr-fnspec.h for a description.
> 
> I suggest also to have a look at the commit log at
> https://gcc.gnu.org/g:2595f25cdaf4f16d04a1078a487b2ecc126cae29
> and at the PR https://gcc.gnu.org/PR92123 for gotchas.
> 
> Tobias
> 
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> Alexander Walter
Jan Hubicka Oct. 15, 2020, 12:48 p.m. UTC | #6
> Hi Honza,
> 
> attached is the patch to fix the fnspec-strings for the caf-api. I have tested
> it and got no regressions with gcc-testsuite and with the opencoarray's
> testsuite. So that seems fine. Hope this helps and again thank you for your
> instant support on IRC.

Thanks a lot for fixing this! Once the patch is in, I will enable the
verifier.  (and most of support was done by Richi anyway :)

Honza
> 
> Regards,
> 	Andre
> 
> On Wed, 7 Oct 2020 13:28:56 +0200
> Tobias Burnus <tobias@codesourcery.com> wrote:
> 
> > Hi Andre,
> > 
> > On 10/7/20 12:21 PM, Andre Vehreschild wrote:
> > > I am confused. Given that on 2. Oct. 2020 you committed changes to the
> > > caf-fn_spec strings means: you don't need anymore help on this?  
> > 
> > Do you mean the change by the patch "Perforate fnspec attribute strings"?
> > (https://gcc.gnu.org/g:762cca0023c9bdbd762c44f33a954845bbccd568)
> > That one just added spaces for the updated fnspec format.
> > 
> > Otherwise:
> > See gcc/attr-fnspec.h for a description.
> > 
> > I suggest also to have a look at the commit log at
> > https://gcc.gnu.org/g:2595f25cdaf4f16d04a1078a487b2ecc126cae29
> > and at the PR https://gcc.gnu.org/PR92123 for gotchas.
> > 
> > Tobias
> > 
> > -----------------
> > Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> > Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> > Alexander Walter
> 
> 
> -- 
> Andre Vehreschild * Email: vehre ad gmx dot de 

> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
> index 5940a1fd10c..fca1622edd1 100644
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -3832,9 +3832,9 @@ gfc_build_builtin_function_decls (void)
>        pppchar_type
>  	= build_pointer_type (build_pointer_type (pchar_type_node));
> 
> -      gfor_fndecl_caf_init = gfc_build_library_function_decl (
> -	get_identifier (PREFIX("caf_init")), void_type_node,
> -	2, pint_type, pppchar_type);
> +      gfor_fndecl_caf_init = gfc_build_library_function_decl_with_spec (
> +	get_identifier (PREFIX("caf_init")), ". W W ",
> +	void_type_node, 2, pint_type, pppchar_type);
> 
>        gfor_fndecl_caf_finalize = gfc_build_library_function_decl (
>  	get_identifier (PREFIX("caf_finalize")), void_type_node, 0);
> @@ -3848,47 +3848,47 @@ 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")), "R R W W W W R ",
> +	get_identifier (PREFIX("caf_register")), ". . . W w w w . ",
>  	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")), "W R W W R ",
> +	get_identifier (PREFIX("caf_deregister")), ". W . w w . ",
>  	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 . R R W R R R W ",
> +	get_identifier (PREFIX("caf_get")), ". r . . r r w . . . 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 . R R R R R R W R ",
> +	get_identifier (PREFIX("caf_send")), ". r . . w r r . . . w ",
>  	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 . R R R R . R R R R R R ",
> +	get_identifier (PREFIX("caf_sendget")), ". r . . w r r . . r r . . . w ",
>  	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")), ". R W R R R R R W R ",
> +	get_identifier (PREFIX("caf_get_by_ref")), ". r . w r . . . . w . ",
>  	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")), ". R R R R R R R W R ",
> +	get_identifier (PREFIX("caf_send_by_ref")), ". r . r r . . . . w . ",
>  	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);
> @@ -3896,7 +3896,7 @@ gfc_build_builtin_function_decls (void)
>        gfor_fndecl_caf_sendget_by_ref
>  	  = gfc_build_library_function_decl_with_spec (
>  	    get_identifier (PREFIX("caf_sendget_by_ref")),
> -	    ". R R . R R R R R W W R R ",
> +	    ". r . r r . r . . . w w . . ",
>  	    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,
> @@ -3904,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")), ". W W . ", 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")), ". W W . ", 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")), ". . R W W . ", 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);
> 
> @@ -3923,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;
> @@ -3935,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 . . R W ",
> +	get_identifier (PREFIX("caf_atomic_define")), ". 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_ref = gfc_build_library_function_decl_with_spec (
> -	get_identifier (PREFIX("caf_atomic_ref")), "R . . W W ",
> +	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 . . W R R W ",
> +	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 . . R W W ",
> +	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 . . W W W ",
> +	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 . . W W ",
> +	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 . . W W ",
> +	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 . . W W ",
> +	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 . . W W ",
> +	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);
> 
> @@ -3994,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")), "W R R ",
> +	    get_identifier (PREFIX("caf_failed_images")), ". w . 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")), "R W R ",
> +	    get_identifier (PREFIX("caf_form_team")), ". . W . ",
>  	    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")), "R R ",
> +	    get_identifier (PREFIX("caf_change_team")), ". w . ",
>  	    void_type_node, 2, ppvoid_type_node,
>  	    integer_type_node);
> 
> @@ -4021,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")), "R R ",
> +	    get_identifier (PREFIX("caf_sync_team")), ". r . ",
>  	    void_type_node, 2, ppvoid_type_node,
>  	    integer_type_node);
> 
>        gfor_fndecl_caf_team_number
>        	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_team_number")), "R ",
> +	    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")), "R R ",
> +	    get_identifier (PREFIX("caf_image_status")), ". . r ",
>  	    integer_type_node, 2, integer_type_node, ppvoid_type_node);
> 
>        gfor_fndecl_caf_stopped_images
>  	= gfc_build_library_function_decl_with_spec (
> -	    get_identifier (PREFIX("caf_stopped_images")), "W R R ",
> +	    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 . W W ",
> +	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 . W W ",
> +	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 . W W ",
> +	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 . W W ",
> +	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)),
> @@ -4065,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 . W W ",
> +	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")), "R R R ",
> +	get_identifier (PREFIX("caf_is_present")), ". r . r ",
>  	integer_type_node, 3, pvoid_type_node, integer_type_node,
>  	pvoid_type_node);
>      }
diff mbox series

Patch

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 2be9df40d2c..59ea891915e 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3514,8 +3514,8 @@  gfc_build_intrinsic_function_decls (void)
   DECL_PURE_P (gfor_fndecl_si_kind) = 1;
   TREE_NOTHROW (gfor_fndecl_si_kind) = 1;
 
-  gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("selected_real_kind2008")), ".RR",
+  gfor_fndecl_sr_kind = gfc_build_library_function_decl (
+	get_identifier (PREFIX("selected_real_kind2008")),
 	gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
 	pvoid_type_node);
   DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
@@ -3841,50 +3841,50 @@  gfc_build_builtin_function_decls (void)
 	get_identifier (PREFIX("caf_num_images")), integer_type_node,
 	2, integer_type_node, integer_type_node);
 
-      gfor_fndecl_caf_register = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_register")), "RRWWWWR", void_type_node, 7,
+      gfor_fndecl_caf_register = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_register")), void_type_node, 7,
 	size_type_node, integer_type_node, ppvoid_type_node, pvoid_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node, 5,
+	get_identifier (PREFIX("caf_deregister")), ".W.WW.", void_type_node, 5,
 	ppvoid_type_node, integer_type_node, pint_type, pchar_type_node,
 	size_type_node);
 
-      gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10,
+      gfor_fndecl_caf_get = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_get")), void_type_node, 10,
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, pint_type);
 
-      gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_send")), ".R.RRRRRRWR", void_type_node, 11,
+      gfor_fndecl_caf_send = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_send")), void_type_node, 11,
 	pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, pint_type, pvoid_type_node);
 
-      gfor_fndecl_caf_sendget = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_sendget")), ".R.RRRR.RRRRRR",
+      gfor_fndecl_caf_sendget = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_sendget")),
 	void_type_node,	14, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pvoid_type_node, pvoid_type_node, size_type_node,
 	integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node,
 	integer_type_node, boolean_type_node, integer_type_node);
 
-      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_get_by_ref")), ".RWRRRRRWR", void_type_node,
+      gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_get_by_ref")), void_type_node,
 	10, pvoid_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
 
-      gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_send_by_ref")), ".RRRRRRRWR",
+      gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl (
+	get_identifier (PREFIX("caf_send_by_ref")),
 	void_type_node,	10, pvoid_type_node, integer_type_node, pvoid_type_node,
 	pvoid_type_node, integer_type_node, integer_type_node,
 	boolean_type_node, boolean_type_node, pint_type, integer_type_node);
 
       gfor_fndecl_caf_sendget_by_ref
-	  = gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_sendget_by_ref")), ".RR.RRRRRWWRR",
+	  = gfc_build_library_function_decl (
+	    get_identifier (PREFIX("caf_sendget_by_ref")),
 	    void_type_node, 13, pvoid_type_node, integer_type_node,
 	    pvoid_type_node, pvoid_type_node, integer_type_node,
 	    pvoid_type_node, integer_type_node, integer_type_node,
@@ -3900,7 +3900,7 @@  gfc_build_builtin_function_decls (void)
 	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")), "..RRW.", void_type_node,
 	5, integer_type_node, pint_type, pint_type,
 	pchar_type_node, size_type_node);
 
@@ -3929,49 +3929,49 @@  gfc_build_builtin_function_decls (void)
       TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_str) = 1;
 
       gfor_fndecl_caf_atomic_def = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_define")), "R..RW",
+	get_identifier (PREFIX("caf_atomic_define")), ".R..RW..",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pint_type, integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_ref = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_ref")), "R..WW",
+	get_identifier (PREFIX("caf_atomic_ref")), ".R..WW..",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pint_type, integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_cas = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_cas")), "R..WRRW",
+	get_identifier (PREFIX("caf_atomic_cas")), ".R..WRRW..",
 	void_type_node, 9, pvoid_type_node, size_type_node, integer_type_node,
 	pvoid_type_node, pvoid_type_node, pvoid_type_node, pint_type,
 	integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_atomic_op = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_atomic_op")), ".R..RWW",
+	get_identifier (PREFIX("caf_atomic_op")), "..R..RWW..",
 	void_type_node, 9, integer_type_node, pvoid_type_node, size_type_node,
 	integer_type_node, pvoid_type_node, pvoid_type_node, pint_type,
 	integer_type_node, integer_type_node);
 
       gfor_fndecl_caf_lock = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_lock")), "R..WWW",
+	get_identifier (PREFIX("caf_lock")), ".R..WWW.",
 	void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_unlock = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_unlock")), "R..WW",
+	get_identifier (PREFIX("caf_unlock")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_post = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_post")), "R..WW",
+	get_identifier (PREFIX("caf_event_post")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_wait = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_wait")), "R..WW",
+	get_identifier (PREFIX("caf_event_wait")), ".R..WW.",
 	void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_event_query = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_event_query")), "R..WW",
+	get_identifier (PREFIX("caf_event_query")), ".R..WW",
 	void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node,
 	pint_type, pint_type);
 
@@ -3982,19 +3982,19 @@  gfc_build_builtin_function_decls (void)
 
       gfor_fndecl_caf_failed_images
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_failed_images")), "WRR",
+	    get_identifier (PREFIX("caf_failed_images")), ".WR.",
 	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_caf_form_team
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_form_team")), "RWR",
+	    get_identifier (PREFIX("caf_form_team")), ".RW.",
 	    void_type_node, 3, integer_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_caf_change_team
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_change_team")), "RR",
+	    get_identifier (PREFIX("caf_change_team")), ".R.",
 	    void_type_node, 2, ppvoid_type_node,
 	    integer_type_node);
 
@@ -4009,43 +4009,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.",
 	    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",
-      	    integer_type_node, 1, integer_type_node);
+	= gfc_build_library_function_decl (
+	    get_identifier (PREFIX("caf_team_number")),
+	    integer_type_node, 1, integer_type_node);
 
       gfor_fndecl_caf_image_status
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_image_status")), "RR",
+	    get_identifier (PREFIX("caf_image_status")), "..R",
 	    integer_type_node, 2, integer_type_node, ppvoid_type_node);
 
       gfor_fndecl_caf_stopped_images
 	= gfc_build_library_function_decl_with_spec (
-	    get_identifier (PREFIX("caf_stopped_images")), "WRR",
+	    get_identifier (PREFIX("caf_stopped_images")), ".WR.",
 	    void_type_node, 3, pvoid_type_node, ppvoid_type_node,
 	    integer_type_node);
 
       gfor_fndecl_co_broadcast = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_broadcast")), "W.WW",
+	get_identifier (PREFIX("caf_co_broadcast")), ".W.WW.",
 	void_type_node, 5, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_co_max = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_max")), "W.WW",
+	get_identifier (PREFIX("caf_co_max")), ".W.WW..",
 	void_type_node, 6, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, integer_type_node, size_type_node);
 
       gfor_fndecl_co_min = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_min")), "W.WW",
+	get_identifier (PREFIX("caf_co_min")), ".W.WW..",
 	void_type_node, 6, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, integer_type_node, size_type_node);
 
       gfor_fndecl_co_reduce = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_reduce")), "W.R.WW",
+	get_identifier (PREFIX("caf_co_reduce")), ".W.R.WW..",
 	void_type_node, 8, pvoid_type_node,
 	build_pointer_type (build_varargs_function_type_list (void_type_node,
 							      NULL_TREE)),
@@ -4053,12 +4053,12 @@  gfc_build_builtin_function_decls (void)
 	integer_type_node, size_type_node);
 
       gfor_fndecl_co_sum = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_co_sum")), "W.WW",
+	get_identifier (PREFIX("caf_co_sum")), ".W.WW.",
 	void_type_node, 5, pvoid_type_node, integer_type_node,
 	pint_type, pchar_type_node, size_type_node);
 
       gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec (
-	get_identifier (PREFIX("caf_is_present")), "RRR",
+	get_identifier (PREFIX("caf_is_present")), ".R.R",
 	integer_type_node, 3, pvoid_type_node, integer_type_node,
 	pvoid_type_node);
     }