public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vehre at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/94958] gcc/fortran/trans-array.c:9797: possible typo ?
Date: Tue, 18 Aug 2020 17:04:44 +0000	[thread overview]
Message-ID: <bug-94958-4-b15e7scP6p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94958-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2020-08-18 17:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 16:46 [Bug fortran/94958] New: " dcb314 at hotmail dot com
2020-05-05 16:48 ` [Bug fortran/94958] " dcb314 at hotmail dot com
2020-07-20 10:08 ` dominiq at lps dot ens.fr
2020-07-25 14:54 ` dominiq at lps dot ens.fr
2020-08-11 13:04 ` vehre at gcc dot gnu.org
2020-08-18 17:04 ` vehre at gcc dot gnu.org [this message]
2020-08-20 15:51 ` cvs-commit at gcc dot gnu.org
2020-08-20 15:54 ` vehre at gcc dot gnu.org
2020-08-27 12:54 ` vehre at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94958-4-b15e7scP6p@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).