> On 9/29/20 4:20 PM, Jan Hubicka wrote: > > this patch is not needed but makes it possible to sanity check that > > fnspec match function signature. It turns out that there are quite few > > I'm sending the run-time sanity check patch and few more places that assert. > I'm going to test the patch. > > Martin
> From 3b1ff799c08f6e7adb3eb6fb988599197c639ec0 Mon Sep 17 00:00:00 2001 > From: Martin Liska <mli...@suse.cz> > Date: Tue, 29 Sep 2020 16:35:12 +0200 > Subject: [PATCH] Add trailing dots to > gfc_build_library_function_decl_with_spec. > > gcc/fortran/ChangeLog: > > * trans-decl.c (gfc_build_library_function_decl_with_spec): Add > runtime assert about length of SPEC argument. > (gfc_build_intrinsic_function_decls): Add trailing dots. > (gfc_build_builtin_function_decls): Likewise. My fixup is longer :) All strings starting with R or W are wrong. However I have instances of miamatched lengths say for caf_register, deregister and others. There are few cases where i dropped the sting Such as for caf_sendget_by_ref since I was unable to make sense of it. Honza diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 92242771dde..8a5537432be 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3484,16 +3493,16 @@ gfc_build_intrinsic_function_decls (void) /* Misc. functions. */ gfor_fndecl_ttynam = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("ttynam")), ".W", + get_identifier (PREFIX("ttynam")), ".W..", void_type_node, 3, pchar_type_node, gfc_charlen_type_node, integer_type_node); gfor_fndecl_fdate = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("fdate")), ".W", + get_identifier (PREFIX("fdate")), ".W.", void_type_node, 2, pchar_type_node, gfc_charlen_type_node); gfor_fndecl_ctime = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("ctime")), ".W", + get_identifier (PREFIX("ctime")), ".W..", void_type_node, 3, pchar_type_node, gfc_charlen_type_node, gfc_int8_type_node); @@ -3514,8 +3523,8 @@ gfc_build_intrinsic_function_decls (void) DECL_PURE_P (gfor_fndecl_si_kind) = 1; TREE_NOTHROW (gfor_fndecl_si_kind) = 1; - gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("selected_real_kind2008")), ".RR", + gfor_fndecl_sr_kind = gfc_build_library_function_decl ( + get_identifier (PREFIX("selected_real_kind2008")), gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node, pvoid_type_node); DECL_PURE_P (gfor_fndecl_sr_kind) = 1; @@ -3662,7 +3671,7 @@ gfc_build_intrinsic_function_decls (void) TREE_NOTHROW (gfor_fndecl_size0) = 1; gfor_fndecl_size1 = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("size1")), ".R", + get_identifier (PREFIX("size1")), ".R.", gfc_array_index_type, 2, pvoid_type_node, gfc_array_index_type); DECL_PURE_P (gfor_fndecl_size1) = 1; TREE_NOTHROW (gfor_fndecl_size1) = 1; @@ -3701,7 +3710,7 @@ gfc_build_builtin_function_decls (void) TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric) = 1; gfor_fndecl_stop_string = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("stop_string")), ".R.", + get_identifier (PREFIX("stop_string")), ".R..", void_type_node, 3, pchar_type_node, size_type_node, boolean_type_node); /* STOP doesn't return. */ @@ -3714,7 +3723,7 @@ gfc_build_builtin_function_decls (void) TREE_THIS_VOLATILE (gfor_fndecl_error_stop_numeric) = 1; gfor_fndecl_error_stop_string = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("error_stop_string")), ".R.", + get_identifier (PREFIX("error_stop_string")), ".R..", void_type_node, 3, pchar_type_node, size_type_node, boolean_type_node); /* ERROR STOP doesn't return. */ @@ -3841,50 +3850,50 @@ gfc_build_builtin_function_decls (void) get_identifier (PREFIX("caf_num_images")), integer_type_node, 2, integer_type_node, integer_type_node); - gfor_fndecl_caf_register = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_register")), "RRWWWWR", void_type_node, 7, + gfor_fndecl_caf_register = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_register")), void_type_node, 7, size_type_node, integer_type_node, ppvoid_type_node, pvoid_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node, 5, + get_identifier (PREFIX("caf_deregister")), ".W.WW.", void_type_node, 5, ppvoid_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); - gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10, + gfor_fndecl_caf_get = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_get")), void_type_node, 10, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node, boolean_type_node, pint_type); - gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_send")), ".R.RRRRRRWR", void_type_node, 11, + gfor_fndecl_caf_send = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_send")), void_type_node, 11, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node, boolean_type_node, pint_type, pvoid_type_node); - gfor_fndecl_caf_sendget = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sendget")), ".R.RRRR.RRRRRR", + gfor_fndecl_caf_sendget = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_sendget")), void_type_node, 14, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node, boolean_type_node, integer_type_node); - gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_get_by_ref")), ".RWRRRRRWR", void_type_node, + gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_get_by_ref")), void_type_node, 10, pvoid_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node, boolean_type_node, boolean_type_node, pint_type, integer_type_node); - gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_send_by_ref")), ".RRRRRRRWR", + gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_send_by_ref")), void_type_node, 10, pvoid_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node, boolean_type_node, boolean_type_node, pint_type, integer_type_node); gfor_fndecl_caf_sendget_by_ref - = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sendget_by_ref")), ".RR.RRRRRWWRR", + = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_sendget_by_ref")), void_type_node, 13, pvoid_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node, pvoid_type_node, integer_type_node, integer_type_node, @@ -3892,15 +3901,15 @@ gfc_build_builtin_function_decls (void) integer_type_node); gfor_fndecl_caf_sync_all = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sync_all")), ".WW", void_type_node, + get_identifier (PREFIX("caf_sync_all")), ".WW.", void_type_node, 3, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_sync_memory = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sync_memory")), ".WW", void_type_node, + get_identifier (PREFIX("caf_sync_memory")), ".WW.", void_type_node, 3, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_sync_images = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sync_images")), ".RRWW", void_type_node, + get_identifier (PREFIX("caf_sync_images")), "..RRW.", void_type_node, 5, integer_type_node, pint_type, pint_type, pchar_type_node, size_type_node); @@ -3916,8 +3925,8 @@ gfc_build_builtin_function_decls (void) /* CAF's ERROR STOP doesn't return. */ TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop_str) = 1; - gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_stop_numeric")), ".R.", + gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_stop_numeric")), void_type_node, 1, integer_type_node); /* CAF's STOP doesn't return. */ TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_numeric) = 1; @@ -3929,49 +3938,49 @@ gfc_build_builtin_function_decls (void) TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_str) = 1; gfor_fndecl_caf_atomic_def = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_atomic_define")), "R..RW", + get_identifier (PREFIX("caf_atomic_define")), ".R..RW..", void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pint_type, integer_type_node, integer_type_node); gfor_fndecl_caf_atomic_ref = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_atomic_ref")), "R..WW", + get_identifier (PREFIX("caf_atomic_ref")), ".R..WW..", void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pint_type, integer_type_node, integer_type_node); gfor_fndecl_caf_atomic_cas = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_atomic_cas")), "R..WRRW", + get_identifier (PREFIX("caf_atomic_cas")), ".R..WRRW..", void_type_node, 9, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, pvoid_type_node, pint_type, integer_type_node, integer_type_node); gfor_fndecl_caf_atomic_op = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_atomic_op")), ".R..RWW", + get_identifier (PREFIX("caf_atomic_op")), "..R..RWW..", void_type_node, 9, integer_type_node, pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node, pvoid_type_node, pint_type, integer_type_node, integer_type_node); gfor_fndecl_caf_lock = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_lock")), "R..WWW", + get_identifier (PREFIX("caf_lock")), ".R..WWW.", void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node, pint_type, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_unlock = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_unlock")), "R..WW", + get_identifier (PREFIX("caf_unlock")), ".R..WW.", void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_event_post = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_event_post")), "R..WW", + get_identifier (PREFIX("caf_event_post")), ".R..WW.", void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_event_wait = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_event_wait")), "R..WW", + get_identifier (PREFIX("caf_event_wait")), ".R..WW.", void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_event_query = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_event_query")), "R..WW", + get_identifier (PREFIX("caf_event_query")), ".R..WW", void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node, pint_type, pint_type); @@ -3982,19 +3991,19 @@ gfc_build_builtin_function_decls (void) gfor_fndecl_caf_failed_images = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_failed_images")), "WRR", + get_identifier (PREFIX("caf_failed_images")), ".WR.", void_type_node, 3, pvoid_type_node, ppvoid_type_node, integer_type_node); gfor_fndecl_caf_form_team = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_form_team")), "RWR", + get_identifier (PREFIX("caf_form_team")), ".RW.", void_type_node, 3, integer_type_node, ppvoid_type_node, integer_type_node); gfor_fndecl_caf_change_team = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_change_team")), "RR", + get_identifier (PREFIX("caf_change_team")), ".R.", void_type_node, 2, ppvoid_type_node, integer_type_node); @@ -4003,49 +4012,49 @@ gfc_build_builtin_function_decls (void) get_identifier (PREFIX("caf_end_team")), void_type_node, 0); gfor_fndecl_caf_get_team - = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_get_team")), "R", + = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_get_team")), void_type_node, 1, integer_type_node); gfor_fndecl_caf_sync_team = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_sync_team")), "RR", + get_identifier (PREFIX("caf_sync_team")), ".R.", void_type_node, 2, ppvoid_type_node, integer_type_node); gfor_fndecl_caf_team_number - = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_team_number")), "R", + = gfc_build_library_function_decl ( + get_identifier (PREFIX("caf_team_number")), integer_type_node, 1, integer_type_node); gfor_fndecl_caf_image_status = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_image_status")), "RR", + get_identifier (PREFIX("caf_image_status")), "..R", integer_type_node, 2, integer_type_node, ppvoid_type_node); gfor_fndecl_caf_stopped_images = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_stopped_images")), "WRR", + get_identifier (PREFIX("caf_stopped_images")), ".WR.", void_type_node, 3, pvoid_type_node, ppvoid_type_node, integer_type_node); gfor_fndecl_co_broadcast = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_co_broadcast")), "W.WW", + get_identifier (PREFIX("caf_co_broadcast")), ".W.WW.", void_type_node, 5, pvoid_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_co_max = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_co_max")), "W.WW", + get_identifier (PREFIX("caf_co_max")), ".W.WW..", void_type_node, 6, pvoid_type_node, integer_type_node, pint_type, pchar_type_node, integer_type_node, size_type_node); gfor_fndecl_co_min = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_co_min")), "W.WW", + get_identifier (PREFIX("caf_co_min")), ".W.WW..", void_type_node, 6, pvoid_type_node, integer_type_node, pint_type, pchar_type_node, integer_type_node, size_type_node); gfor_fndecl_co_reduce = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_co_reduce")), "W.R.WW", + get_identifier (PREFIX("caf_co_reduce")), ".W.R.WW..", void_type_node, 8, pvoid_type_node, build_pointer_type (build_varargs_function_type_list (void_type_node, NULL_TREE)), @@ -4053,12 +4062,12 @@ gfc_build_builtin_function_decls (void) integer_type_node, size_type_node); gfor_fndecl_co_sum = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_co_sum")), "W.WW", + get_identifier (PREFIX("caf_co_sum")), ".W.WW.", void_type_node, 5, pvoid_type_node, integer_type_node, pint_type, pchar_type_node, size_type_node); gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec ( - get_identifier (PREFIX("caf_is_present")), "RRR", + get_identifier (PREFIX("caf_is_present")), ".R.R", integer_type_node, 3, pvoid_type_node, integer_type_node, pvoid_type_node); }