public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	trnka@scm.com
Subject: Re: [Patch, fortran] PR112407 - [13/14 Regression] Fix for PR37336 triggers an ICE in gfc_format_decoder while constructing a vtab
Date: Mon, 1 Apr 2024 22:04:49 +0200	[thread overview]
Message-ID: <259997e1-120a-4e40-b04e-8085d68af02b@gmx.de> (raw)
In-Reply-To: <CAGkQGiJHrsEKR9JKGP6GyAso3pSD1+KR4k4nQqGaYWvoruMuCw@mail.gmail.com>

Hi Paul!

Am 31.03.24 um 14:08 schrieb Paul Richard Thomas:
> Hi Harald,
>
>>
>> I had only a quick glance at your patch.  I guess you unintentionally
>> forgot to remove those parts that you already committed for PR110987,
>> along with the finalize-testcases.
>>
>
> Guilty as charged. I guess I got out of the wrong side of the bed :-)
>
>>
>> I am still trying to find the precise paragraph in the standard
>> you refer to regarding INTENT(OUT) and default initialization.
>>
>
> Page 114 of the draft F2023 standard:
> "The INTENT (OUT) attribute for a nonpointer dummy argument specifies that
> the dummy argument becomes undefined on invocation of the procedure, except
> for any subcomponents that are default-initialized (7.5.4.6)."
> With the fix, gfortran behaves in the same way as ifort and nagfor.
>
> On rereading the patch, I think that s/"and use the passed value"/"and
> leave undefined"/ or some such is in order.

Yes, something along this line is better.

I also did test with NAG and Intel, and was surprised (confused?) at how
the count of finalizer calls changes if component "i" gets a default
value or not.  Something one wouldn't do right after getting out of bed!

So the patch looks good to me - except for one philosophical question:

Fortran 2018 makes procedures recursive by default, but this is not
yet implemented as such, and NON_RECURSIVE is not yet implemented.

The new testcase pr112407b.f90 compiles with nagfor -f2018 without
any warnings, and gives an error with nagfor -f2008.  It appears
that it works in the testsuite after the patch and when adding
"-std=f2008" instead of using the default "-std=gnu".

Would you mind adding "-std=f2008" as dg-option to that testcase?
This would avoid one bogus regression when gfortran moves forward.

Thanks for the patch!

Harald

>
>> While at it, I think I found a minor nit in testcase pr112407a.f90:
>> component x%i appears undefined the first time it is printed.
>>
>
> Fixed - thanks for pointing it out.
>
> A correct patch is attached.
>
> Thanks for looking at the previous, overloaded version.
>
> Paul
>
>
>
>>
>>> 2024-03-30  Paul Thomas  <pault@gcc.gnu.org>
>>>
>>> gcc/fortran
>>> PR fortran/112407
>>> *resolve.cc (resolve_procedure_expression): Change the test for
>>> for recursion in the case of hidden procedures from modules.
>>> (resolve_typebound_static): Add warning for possible recursive
>>> calls to typebound procedures.
>>> * trans-expr.cc (gfc_trans_class_init_assign): Do not apply
>>> default initializer to class dummy where component initializers
>>> are all null.
>>>
>>> gcc/testsuite/
>>> PR fortran/112407
>>> * gfortran.dg/pr112407a.f90: New test.
>>> * gfortran.dg/pr112407b.f90: New test.
>>>
>>
>>
>


      reply	other threads:[~2024-04-01 20:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-30  9:06 Paul Richard Thomas
2024-03-30 14:52 ` Harald Anlauf
2024-03-31 12:08   ` Paul Richard Thomas
2024-04-01 20:04     ` Harald Anlauf [this message]

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=259997e1-120a-4e40-b04e-8085d68af02b@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    --cc=trnka@scm.com \
    /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).