https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94958
vehre at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #4 from vehre at gcc dot gnu.org --- Further research showed, that the conseQuences of the mistake are not impacting gfortran in any kind, because the errmsg and errmsg_len are never used. The code here is jumped to only when a derived type containing an allocatable component is broadcasted and then only in caf-lib-mode, e.g.: ! { dg-do compile } ! ! PR fortran/94958 ! implicit none type struct integer, allocatable :: comp end type type(struct) :: a character(kind=1, len=20) :: err integer :: stat call co_broadcast(a, this_image(), stat, err) end gfortran -fcoarray=lib bcast_1.f90 -lcaf_single During traversal of the derived type for bcast, the function call to CO_BROADCAST() for the type 'a' and it's allocatable component 'comp' is never augmented with the nodes for stat, errmsg and errmsg_len. For this small example the code already has two calls to co_broadcast. Which indicates the necessity of having some way to aggregate the stat and errmsg over all these calls. Unfortunately does the Fortran-standard (2015, 2018) not state how to aggregate the stat and/or errmsg for multiple broadcasts. I therefore propose a fix: diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 7a1b2fc74c9..73a45cd2dcf 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -9732,7 +9732,7 @@ gfc_bcast_alloc_comp (gfc_symbol *derived, gfc_expr *expr, int rank, args.image_index = image_index; args.stat = stat; args.errmsg = errmsg; - args.errmsg = errmsg_len; + args.errmsg_len = errmsg_len; if (rank == 0) { as obvious and get done with this pr.