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 <hubi...@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