public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-20 20:36 ` sandra at gcc dot gnu.org
  2022-07-20 21:29 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: sandra at gcc dot gnu.org @ 2021-09-20 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at gcc dot gnu.org

--- Comment #3 from sandra at gcc dot gnu.org ---
Still present on trunk.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
  2021-09-20 20:36 ` [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped sandra at gcc dot gnu.org
@ 2022-07-20 21:29 ` anlauf at gcc dot gnu.org
  2022-07-21 20:13 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-20 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
           Keywords|                            |rejects-valid

--- Comment #4 from anlauf at gcc dot gnu.org ---
The following patch seems to work:

diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 91d87a1b2c1..6365c4ab809 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -1502,8 +1502,17 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr
*target)
     t = false;
   /* F2018 C838 explicitly allows an assumed-rank variable as the first
      argument of intrinsic inquiry functions.  */
-  if (pointer->rank != -1 && !rank_check (target, 0, pointer->rank))
-    t = false;
+  if (pointer->rank != -1 && target->rank != 1 && pointer->rank !=
target->rank)
+    {
+      if (gfc_option.warn_std & GFC_STD_F2003)
+       {
+         if (!rank_check (target, 0, pointer->rank))
+           t = false;
+       }
+      else if (!gfc_notify_std (GFC_STD_F2008, "Rank remapping target is not "
+                               "rank 1 at %L", &target->where))
+       t = false;
+    }
   if (target->rank > 0 && target->ref)
     {
       for (i = 0; i < target->rank; i++)

Needs regtesting.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
  2021-09-20 20:36 ` [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped sandra at gcc dot gnu.org
  2022-07-20 21:29 ` anlauf at gcc dot gnu.org
@ 2022-07-21 20:13 ` anlauf at gcc dot gnu.org
  2022-07-25 16:05 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-21 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
Submitted version: https://gcc.gnu.org/pipermail/fortran/2022-July/058012.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-07-21 20:13 ` anlauf at gcc dot gnu.org
@ 2022-07-25 16:05 ` anlauf at gcc dot gnu.org
  2022-07-31 18:49 ` cvs-commit at gcc dot gnu.org
  2022-07-31 18:57 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-25 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #6 from anlauf at gcc dot gnu.org ---
The following thread in the Intel compiler forum suggests that the code
in comment#0 is likely invalid:

https://community.intel.com/t5/Intel-Fortran-Compiler/Intel-rejects-ASSOCIATED-pointer-target-for-non-equal-ranks/m-p/1402799/highlight/true#M162159

Withdrawing the patch.

@Paul: shall we mark the PR as invalid?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-07-25 16:05 ` anlauf at gcc dot gnu.org
@ 2022-07-31 18:49 ` cvs-commit at gcc dot gnu.org
  2022-07-31 18:57 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-31 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:0110cfd5449bae3a772f45ea2e4c5dab5b7a8ccd

commit r13-1904-g0110cfd5449bae3a772f45ea2e4c5dab5b7a8ccd
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jul 27 21:34:22 2022 +0200

    Fortran: fix invalid rank error in ASSOCIATED when rank is remapped
[PR77652]

    gcc/fortran/ChangeLog:

            PR fortran/77652
            * check.cc (gfc_check_associated): Make the rank check of POINTER
            vs. TARGET match the allowed forms of pointer assignment for the
            selected Fortran standard.

    gcc/testsuite/ChangeLog:

            PR fortran/77652
            * gfortran.dg/associated_target_9a.f90: New test.
            * gfortran.dg/associated_target_9b.f90: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped
       [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-07-31 18:49 ` cvs-commit at gcc dot gnu.org
@ 2022-07-31 18:57 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-31 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
I have pushed a relaxed version of the checks as agreed upon on the ML.

As compilers seem to differ here (we are now closer to Crayftn and Nvidia),
and as suggested by Toon, Mikael plans to submit an interpretation request.

We might want to keep this PR open to track updates on the issue.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-31 18:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-77652-4@http.gcc.gnu.org/bugzilla/>
2021-09-20 20:36 ` [Bug fortran/77652] Invalid rank error in ASSOCIATED when rank is remapped sandra at gcc dot gnu.org
2022-07-20 21:29 ` anlauf at gcc dot gnu.org
2022-07-21 20:13 ` anlauf at gcc dot gnu.org
2022-07-25 16:05 ` anlauf at gcc dot gnu.org
2022-07-31 18:49 ` cvs-commit at gcc dot gnu.org
2022-07-31 18:57 ` anlauf at gcc dot gnu.org

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).