From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 73A5C3858D1E for ; Fri, 11 Feb 2022 09:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 73A5C3858D1E Received: by mail-qv1-xf31.google.com with SMTP id a28so7939873qvb.10 for ; Fri, 11 Feb 2022 01:08:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fopNpgs7XoCoOyWxKQBM7P7nNoK/o3sPeXb7mFEQLA4=; b=dV/EGST6+jZVk3nV8Lkx+TRMbx0on9kAs3uAghthLDA/PepDv38Z97TGqF69jCDMrA 5pMcrHp2TQdHaOEGdIEK1r9aisnaGFKhK9rzQOBPBeBpBdPy6pYZS/OIUmIp3UE4+IFo C5QFKTL1OW9AwfXBZC56nVNo5pZfcosRNF4m2PuF3tI7tc0TPaGcGNBsTAPxQUtTLkUz D+Sie7Oko9KCMx38n+xRKPOKeNe6NQJRuD3qXcL01aSe/jnVx25S+uqgerdriuUwNHP3 Qcdflb8B2gYMnoPNlBM0H0TvX7Rv2WbMLR8DwO2opPVHqv9uTUau/LwQnarWq8+3s4uF MXUA== X-Gm-Message-State: AOAM533KWZFr/Iz8gh+Bu9H8/BWcU2R8Mk0G+1AmUm8Rj9aWOkHpjMrq up1s50hXe1NPZC62B1NZ4Np0P6Vioyl6RG24gHs= X-Google-Smtp-Source: ABdhPJzQVAgJEzxW1nnD3rjwLrugDst8t4G6/6Yg8n9ejHVesDtghDcjczOI7T0W3mvj2k410bGT9a87Sf2g8Fz13N0= X-Received: by 2002:a05:6214:f09:: with SMTP id gw9mr395208qvb.60.1644570496941; Fri, 11 Feb 2022 01:08:16 -0800 (PST) MIME-Version: 1.0 References: <9a2667e2-8055-bcac-1862-05c8ac60ce7a@gmx.de> <3cbaf568-84ac-8498-558f-9560fe395d66@gmx.de> In-Reply-To: <3cbaf568-84ac-8498-558f-9560fe395d66@gmx.de> From: Paul Richard Thomas Date: Fri, 11 Feb 2022 09:08:06 +0000 Message-ID: Subject: Re: [Patch, fortran] PR37336 (Finalization) - [F03] Finish derived-type finalization To: Harald Anlauf Cc: Alessandro Fanfarillo , Andrew Benson , "fortran@gcc.gnu.org" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2022 09:08:18 -0000 Hi Harald, I have taken gcc-patches out of the loop for now :-) I am really sorry to be such a bother, but before we think we should > do the same as Intel, we need to understand what Intel does and whether > that is actually correct. Or not inconsistent with the standard. > And I would really like to understand even the most simple, stupid case. > You are not being a bother. I am happy that you are taking an interest. ....snip.... > > So my stupid questions are: > > - is ThyType invoking a constructor? It is a parameter, after all. > Should using it in an assignment invoke a destructor? If so why? > > And why does Intel then increment the final_count? > > - is the initialization of ThyType2 invoking a constructor? > It might, if that is the implementation in the compiler, but > should there be a finalization? > > 7.5.6.3 When finalization occurs 1 When an intrinsic assignment statement is executed (10.2.1.3), if the variable is not an unallocated allocatable variable, it is finalized after evaluation of expr and before the definition of the variable. If the variable is an allocated allocatable variable, or has an allocated allocatable subobject, that would be deallocated by intrinsic assignment, the finalization occurs before the deallocation. Your "stupid questions" are not at all stupid. The finalization of 'variable' that occurs in your testcase demonstrates that the finalization with my patch is occurring at the wrong time. I now see that NAG is correct on this. Please press on with the questions! Regards Paul