public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/86277] Presence of optional arguments not recognized for zero length arrays
Date: Mon, 12 Jun 2023 20:32:20 +0000	[thread overview]
Message-ID: <bug-86277-4-y230VjTQzw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-86277-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #29 from anlauf at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #28)
> (In reply to anlauf from comment #27)
> > (In reply to Mikael Morin from comment #25)
> > > (In reply to Mikael Morin from comment #24)
> > > > (In reply to Mikael Morin from comment #23)
> > > > > 
> > > > > This regresses on pr108065.f90 (that's a few extra analyzer warnings),
> > > > > and on pr69955.f90 (that's one extra __builtin_malloc).
> > > > 
> > > > This removes the regressions.  Not fully retested again.
> > > > 
> > > Comment #23 is probably the more correct one.
> > > Comment #24 works because of the double temporary.  Even if the first
> > > temporary has NULL data component, the second one uses malloc
> > > unconditionally to set data, and the argument is seen as present.
> > 
> > Are you sure that you haven't mixed up those two?
> > 
> > When trying with my extended testcase, and looking at the tree dump,
> > I see a double temporary for the call
> > 
> >     call i ([real:: y])
> > 
> > where the data pointer to the first allocation is clobbered later.
> > So I would rather go with the version from comment #24.
> > 
> Let's rephrase:
> When (or rather if) we manage to remove the double temporary, we'll regress
> with comment #24, not with comment #23.
> The reallocation remains by the way, it's only pushed one step away.
> Try this for example:
> 
>     call i([real:: y, y])

I do see the reallocation, but in the case of the patch in #24 it is a
realloc of a NULL, which is well-defined nowadays.

But I do not see a regression.  On the contrary, every else seems unchanged.

>  
> > If you don't object, I'll package the patch with testcases and submit.
> 
> No problem, I think we are safe with the second temporary.

Besides the issue with one or two temporaries, is there anything else?

  parent reply	other threads:[~2023-06-12 20:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-86277-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` jakub at gcc dot gnu.org
2021-06-01  8:11 ` rguenth at gcc dot gnu.org
2022-05-27  8:19 ` rguenth at gcc dot gnu.org
2023-06-09 19:48 ` anlauf at gcc dot gnu.org
2023-06-09 19:48 ` anlauf at gcc dot gnu.org
2023-06-10 10:27 ` mikael at gcc dot gnu.org
2023-06-10 10:30 ` mikael at gcc dot gnu.org
2023-06-10 10:40 ` mikael at gcc dot gnu.org
2023-06-10 11:45 ` mikael at gcc dot gnu.org
2023-06-10 13:21 ` anlauf at gcc dot gnu.org
2023-06-10 13:25 ` anlauf at gcc dot gnu.org
2023-06-10 19:27 ` anlauf at gcc dot gnu.org
2023-06-10 19:55 ` mikael at gcc dot gnu.org
2023-06-10 20:07 ` mikael at gcc dot gnu.org
2023-06-10 20:17 ` mikael at gcc dot gnu.org
2023-06-10 20:33 ` mikael at gcc dot gnu.org
2023-06-11 20:44 ` anlauf at gcc dot gnu.org
2023-06-12  7:13 ` mikael at gcc dot gnu.org
2023-06-12  7:39 ` mikael at gcc dot gnu.org
2023-06-12  7:56 ` mikael at gcc dot gnu.org
2023-06-12  8:17 ` mikael at gcc dot gnu.org
2023-06-12 10:38 ` mikael at gcc dot gnu.org
2023-06-12 19:42 ` anlauf at gcc dot gnu.org
2023-06-12 19:47 ` anlauf at gcc dot gnu.org
2023-06-12 20:16 ` mikael at gcc dot gnu.org
2023-06-12 20:32 ` anlauf at gcc dot gnu.org [this message]
2023-06-12 20:51 ` mikael at gcc dot gnu.org
2023-06-12 21:00 ` anlauf at gcc dot gnu.org
2023-06-12 21:14 ` anlauf at gcc dot gnu.org
2023-06-13 18:09 ` cvs-commit at gcc dot gnu.org
2023-06-13 19:30 ` anlauf at gcc dot gnu.org
2023-06-29 19:50 ` cvs-commit at gcc dot gnu.org
2023-06-29 19:53 ` anlauf 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-86277-4-y230VjTQzw@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).