public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/97592] [11/12/13/14 Regression] Incorrectly set pointer remapping with array pointer argument to CONTIGUOUS dummy
Date: Fri, 15 Dec 2023 22:31:09 +0000	[thread overview]
Message-ID: <bug-97592-4-UdVlsaiMhv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97592-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97592

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
> It looks like argument association is confused here.
> (The F2018 reference is 15.5.2.3 and 15.5.2.4).
> 
> The following patch appears to fix the testcase:
> 
> diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> index 06713f24f95..c7fb4633ab1 100644
> --- a/gcc/fortran/trans-expr.cc
> +++ b/gcc/fortran/trans-expr.cc
> @@ -6854,7 +6854,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
>                                              INTENT_IN, fsym->attr.pointer);
>                 }
>               else if (fsym && fsym->attr.contiguous
> -                      && !gfc_is_simply_contiguous (e, false, true)
> +                      && gfc_is_not_contiguous (e)
>                        && gfc_expr_is_variable (e))
>                 {
>                   gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,
> 
> but unfortunately regresses on gfortran.dg/bind-c-contiguous-3.f90 :-(

This works:

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index b2463a28748..7bc6d72decc 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7124,7 +7125,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                             INTENT_IN, fsym->attr.pointer);
                }
              else if (fsym && fsym->attr.contiguous
-                      && !gfc_is_simply_contiguous (e, false, true)
+                      && (fsym->attr.target
+                          ? gfc_is_not_contiguous (e)
+                          : !gfc_is_simply_contiguous (e, false, true))
                       && gfc_expr_is_variable (e))
                {
                  gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,

  parent reply	other threads:[~2023-12-15 22:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 14:25 [Bug fortran/97592] New: " reubendb at gmail dot com
2020-10-27 19:07 ` [Bug fortran/97592] " anlauf at gcc dot gnu.org
2021-02-14 18:17 ` dominiq at lps dot ens.fr
2022-03-14 21:39 ` anlauf at gcc dot gnu.org
2023-03-21 19:44 ` [Bug fortran/97592] [10/11/12/13 Regression] " anlauf at gcc dot gnu.org
2023-03-21 19:57 ` anlauf at gcc dot gnu.org
2023-07-07 10:38 ` [Bug fortran/97592] [11/12/13/14 " rguenth at gcc dot gnu.org
2023-12-15 22:31 ` anlauf at gcc dot gnu.org [this message]
2023-12-16 18:29 ` anlauf at gcc dot gnu.org
2023-12-17 17:33 ` cvs-commit at gcc dot gnu.org
2023-12-27 19:27 ` cvs-commit at gcc dot gnu.org
2023-12-27 19:33 ` anlauf 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-97592-4-UdVlsaiMhv@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).