public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105170] New: Invalid finalization in intrinsic assignment
@ 2022-04-05 19:58 baradi09 at gmail dot com
  2023-12-07 21:26 ` [Bug fortran/105170] " anlauf at gcc dot gnu.org
  2023-12-08 15:34 ` baradi09 at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: baradi09 at gmail dot com @ 2022-04-05 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105170
           Summary: Invalid finalization in intrinsic assignment
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baradi09 at gmail dot com
  Target Milestone: ---

Created attachment 52754
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52754&action=edit
Minimal working example demonstrating the bug

I have a derived type (TWrapper), which has a component with defined
assignment. The containing derived type itself has no defined assignment. Upon
an assignment between two TWrapper instances, a copy of the RHS seems to get
finalized.

The attached MWE demonstrates the problem.

Expected output (as delivered by current Intel and NAG compilers):

RefCounter_final, id:0
TRefCounter_init: id:42
-> Assignment wrapper2 = wrapper
TRefCounter_final, id:0
TRefCounter_final, id:0
TRefCounter_assign: this%id, other%id: 0 42

GFortran output:

TRefCounter_final, id:0
TRefCounter_init: id:42
-> Assignment wrapper2 = wrapper
TRefCounter_final, id:42
TRefCounter_assign: this%id, other%id: 0 42

One finalization seems to be missing. Additionally, the finalized instance
seems to be a copy of the RHS. (A copy, because after the finalization, the RHS
still seems to have kept its id-value...)

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

* [Bug fortran/105170] Invalid finalization in intrinsic assignment
  2022-04-05 19:58 [Bug fortran/105170] New: Invalid finalization in intrinsic assignment baradi09 at gmail dot com
@ 2023-12-07 21:26 ` anlauf at gcc dot gnu.org
  2023-12-08 15:34 ` baradi09 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-07 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-12-07
           Keywords|                            |wrong-code
     Ever confirmed|0                           |1
      Known to work|                            |13.2.1, 14.0
      Known to fail|                            |11.4.1, 12.3.1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from anlauf at gcc dot gnu.org ---
With current gcc-14 trunk and also current 13-branch I get the result
you expect.  Likely fixed by Paul's big finalization patch.

Can you please check?

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

* [Bug fortran/105170] Invalid finalization in intrinsic assignment
  2022-04-05 19:58 [Bug fortran/105170] New: Invalid finalization in intrinsic assignment baradi09 at gmail dot com
  2023-12-07 21:26 ` [Bug fortran/105170] " anlauf at gcc dot gnu.org
@ 2023-12-08 15:34 ` baradi09 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: baradi09 at gmail dot com @ 2023-12-08 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Bálint Aradi <baradi09 at gmail dot com> ---
Thanks, with 13.2.0, it seems to behave correctly.

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

end of thread, other threads:[~2023-12-08 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 19:58 [Bug fortran/105170] New: Invalid finalization in intrinsic assignment baradi09 at gmail dot com
2023-12-07 21:26 ` [Bug fortran/105170] " anlauf at gcc dot gnu.org
2023-12-08 15:34 ` baradi09 at gmail dot com

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