public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115039] New: Statement function with inquiry refs rejected
@ 2024-05-10 18:22 anlauf at gcc dot gnu.org
  2024-05-10 18:22 ` [Bug fortran/115039] " anlauf at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-10 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115039
           Summary: Statement function with inquiry refs rejected
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

As reported in:

https://fortran-lang.discourse.group/t/real-and-imaginary-parts-of-complex-number/1113/18

an inquiry reference (%re, %im) is incorrectly reported as a recursive
reference.

Testcase:

program testit
implicit none
complex :: x
real    :: img
img(x) = x%im
   write (*, *) img((1.0,3.0) + (2.0,4.0))
end program testit


Tentative fix:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 66edad58278..94ec2ce21dd 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -5500,7 +5546,8 @@ gfc_traverse_expr (gfc_expr *expr, gfc_symbol *sym,
          break;

        case REF_INQUIRY:
-         return true;
+         /* An inquiry_ref does not collide with a symbol.  */
+         return false;

        default:
          gcc_unreachable ();

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
@ 2024-05-10 18:22 ` anlauf at gcc dot gnu.org
  2024-05-10 19:25 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-10 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
           Keywords|                            |rejects-valid

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
  2024-05-10 18:22 ` [Bug fortran/115039] " anlauf at gcc dot gnu.org
@ 2024-05-10 19:25 ` anlauf at gcc dot gnu.org
  2024-05-11 17:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-10 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-May/060500.html

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
  2024-05-10 18:22 ` [Bug fortran/115039] " anlauf at gcc dot gnu.org
  2024-05-10 19:25 ` anlauf at gcc dot gnu.org
@ 2024-05-11 17:42 ` cvs-commit at gcc dot gnu.org
  2024-05-21 19:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-11 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC 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:d4974fd22730014e337fd7ec2471945ba8afb00e

commit r15-385-gd4974fd22730014e337fd7ec2471945ba8afb00e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri May 10 21:18:03 2024 +0200

    Fortran: fix dependency checks for inquiry refs [PR115039]

    gcc/fortran/ChangeLog:

            PR fortran/115039
            * expr.cc (gfc_traverse_expr): An inquiry ref does not constitute
            a dependency and cannot collide with a symbol.

    gcc/testsuite/ChangeLog:

            PR fortran/115039
            * gfortran.dg/statement_function_5.f90: New test.

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-11 17:42 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21 19:03 ` cvs-commit at gcc dot gnu.org
  2024-05-21 19:06 ` cvs-commit at gcc dot gnu.org
  2024-05-21 19:08 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-21 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:edde60a53c7d4ee5a58c9835c8e1e1758ba636f7

commit r14-10225-gedde60a53c7d4ee5a58c9835c8e1e1758ba636f7
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri May 10 21:18:03 2024 +0200

    Fortran: fix dependency checks for inquiry refs [PR115039]

    gcc/fortran/ChangeLog:

            PR fortran/115039
            * expr.cc (gfc_traverse_expr): An inquiry ref does not constitute
            a dependency and cannot collide with a symbol.

    gcc/testsuite/ChangeLog:

            PR fortran/115039
            * gfortran.dg/statement_function_5.f90: New test.

    (cherry picked from commit d4974fd22730014e337fd7ec2471945ba8afb00e)

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-21 19:03 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21 19:06 ` cvs-commit at gcc dot gnu.org
  2024-05-21 19:08 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-21 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:5ed32d00a7b408baa48d85e841740e73c8504d7a

commit r13-8786-g5ed32d00a7b408baa48d85e841740e73c8504d7a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri May 10 21:18:03 2024 +0200

    Fortran: fix dependency checks for inquiry refs [PR115039]

    gcc/fortran/ChangeLog:

            PR fortran/115039
            * expr.cc (gfc_traverse_expr): An inquiry ref does not constitute
            a dependency and cannot collide with a symbol.

    gcc/testsuite/ChangeLog:

            PR fortran/115039
            * gfortran.dg/statement_function_5.f90: New test.

    (cherry picked from commit d4974fd22730014e337fd7ec2471945ba8afb00e)

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

* [Bug fortran/115039] Statement function with inquiry refs rejected
  2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-21 19:06 ` cvs-commit at gcc dot gnu.org
@ 2024-05-21 19:08 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-21 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.4
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed in gcc-15, and backported to 14.2 and 13.4.

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

end of thread, other threads:[~2024-05-21 19:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 18:22 [Bug fortran/115039] New: Statement function with inquiry refs rejected anlauf at gcc dot gnu.org
2024-05-10 18:22 ` [Bug fortran/115039] " anlauf at gcc dot gnu.org
2024-05-10 19:25 ` anlauf at gcc dot gnu.org
2024-05-11 17:42 ` cvs-commit at gcc dot gnu.org
2024-05-21 19:03 ` cvs-commit at gcc dot gnu.org
2024-05-21 19:06 ` cvs-commit at gcc dot gnu.org
2024-05-21 19:08 ` 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).