public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/113892] New: Missing temporary in assignment for array-valued function referencing host-associated array
@ 2024-02-12 18:36 anlauf at gcc dot gnu.org
  2024-02-17 20:21 ` [Bug fortran/113892] " anlauf at gcc dot gnu.org
  2024-02-17 20:25 ` anlauf at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-02-12 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113892
           Summary: Missing temporary in assignment for array-valued
                    function referencing host-associated array
           Product: gcc
           Version: 14.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: ---

Created attachment 57402
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57402&action=edit
Testcase

The attached testcase is a slightly rewritten version of the discussion at:

https://fortran-lang.discourse.group/t/creating-temporary-array-when-declared-in-a-module/7379

All gfortran versions print:

          11          21          31
          12          22          32
          13          23          33

          11          12          13    T F F
          12          22          23    T T F
          13          23          33    T T T

Expected:

          11          21          31
          12          22          32
          13          23          33

          11          21          31    T T T
          12          22          32    T T T
          13          23          33    T T T

What happens?

Function create_matrix takes the host-associated array "am" and returns the
TRANSPOSE(am).  When assigning the result directly to "am" we get a wrong
result because no temporary is created.

Maybe the dependency analysis of assignments needs to take care of the
possibility that a non-elemental function might access a host-associated
(or USE-associated or COMMON) variable appearing on the lhs.

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

* [Bug fortran/113892] Missing temporary in assignment for array-valued function referencing host-associated array
  2024-02-12 18:36 [Bug fortran/113892] New: Missing temporary in assignment for array-valued function referencing host-associated array anlauf at gcc dot gnu.org
@ 2024-02-17 20:21 ` anlauf at gcc dot gnu.org
  2024-02-17 20:25 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-02-17 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |comptes at ugo235 dot fr

--- Comment #1 from anlauf at gcc dot gnu.org ---
*** Bug 113975 has been marked as a duplicate of this bug. ***

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

* [Bug fortran/113892] Missing temporary in assignment for array-valued function referencing host-associated array
  2024-02-12 18:36 [Bug fortran/113892] New: Missing temporary in assignment for array-valued function referencing host-associated array anlauf at gcc dot gnu.org
  2024-02-17 20:21 ` [Bug fortran/113892] " anlauf at gcc dot gnu.org
@ 2024-02-17 20:25 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-02-17 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-17
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from anlauf at gcc dot gnu.org ---
Note that in F2023 we could use the new attribute SIMPLE to control
which optimizations could be done in an assignment.  Here the referenced
functions are only PURE.

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

end of thread, other threads:[~2024-02-17 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 18:36 [Bug fortran/113892] New: Missing temporary in assignment for array-valued function referencing host-associated array anlauf at gcc dot gnu.org
2024-02-17 20:21 ` [Bug fortran/113892] " anlauf at gcc dot gnu.org
2024-02-17 20:25 ` 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).