public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "baradi09 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/67444] New: RHS of overloaded assignment not finalized
Date: Thu, 03 Sep 2015 12:46:00 -0000	[thread overview]
Message-ID: <bug-67444-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 67444
           Summary: RHS of overloaded assignment not finalized
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baradi09 at gmail dot com
  Target Milestone: ---

Created attachment 36291
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36291&action=edit
Fortran file demonstrating the issue

Dear developer,

Thank you for your continuous effort to provide a free Fortran compiler with
OOP-features.

In my oppinion, Gfortran behaves incorrectly, when instances of polymorphic
types with user defined constructors are assigned to each other. Having an
assignment of the type

a = MyType()

where also "a" is type(MyType) I'd expect expect following calling sequence:

* Constructor for MyType() producing the LHS
* Destructor (final procedure) of MyType finalizing instance "a"
* Assignment of MyType
* Destructor for MyType to finalize the RHS of the assignment.

According to the attached example, however, the last step is missing. I've
checked the example with two other compilers, they all produced the sequence as
given above. With gfortran, I get the output

Starting using Basic:
initBasic START
initBasic END
Destructing Basic -1
assignBasic START
assignBasic END
Values in basic:  43
Destructing Basic 43

while the correct one (with the additional line 7) should be.

Starting using Basic:
initBasic START
initBasic END
Destructing Basic -1
assignBasic START
assignBasic END
Destructing Basic 42
Values in basic:  43
Destructing Basic 43


             reply	other threads:[~2015-09-03 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 12:46 baradi09 at gmail dot com [this message]
2015-09-03 16:17 ` [Bug fortran/67444] RHS in assignment of polymorphic types " dominiq at lps dot ens.fr
2015-09-04 12:29 ` baradi09 at gmail dot com
2023-03-18  7:56 ` [Bug fortran/67444] [F03] " cvs-commit at gcc dot gnu.org
2023-03-18 15:22 ` pault 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-67444-4@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).