public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/93956] Wrong array creation with p => array_dt(1:n)%component
Date: Tue, 14 Apr 2020 17:16:24 +0000	[thread overview]
Message-ID: <bug-93956-4-0OurbocYor@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93956-4@http.gcc.gnu.org/bugzilla/>

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |pault at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-14
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to martin from comment #0)
> The following code (compiled without any options) prints "15000, 10000" for
> the second call to foo, instead of the expected "20000, 10000". The first
> call to foo gives the expected result. This is also reproducible with
> gfortran-10 branch.
> 
> This code is a variation of the one reported in bug 93918 to further
> understand temporary array creation.
> 
> program array_temps
> implicit none
> 
> type :: tt
>    integer :: u = 1
>    integer :: v = 2
> end type tt
> 
> type(tt), dimension(:), pointer :: r
> integer :: n
> integer, dimension(:), pointer :: p
> 
> allocate(r(1:n))

This test case does not define n.

Assuming you want to write n=10000 in there,
I concur that the output should be as you describe.

I assume that the span is not used correctly in the
function.

The test case works if you do

p => r(:)%v

instead of the call to get().

  parent reply	other threads:[~2020-04-14 17:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93956-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 12:04 ` marxin at gcc dot gnu.org
2020-04-14 17:16 ` tkoenig at gcc dot gnu.org [this message]
2020-04-20  5:26 ` mscfd at gmx dot net
2020-04-20 14:36 ` tkoenig at gcc dot gnu.org
2020-04-20 16:08 ` tkoenig at gcc dot gnu.org
2020-04-20 18:42 ` tkoenig at gcc dot gnu.org
2020-04-21 18:48 ` tkoenig at gcc dot gnu.org
2020-04-23 18:31 ` cvs-commit at gcc dot gnu.org
2020-04-24  6:23 ` cvs-commit at gcc dot gnu.org
2020-04-24  7:27 ` cvs-commit at gcc dot gnu.org
2020-04-24  7:28 ` tkoenig at gcc dot gnu.org
2020-04-24  7:28 ` tkoenig at gcc dot gnu.org
2020-04-26 12:52 ` cvs-commit at gcc dot gnu.org
2020-04-27 21:51 ` cvs-commit at gcc dot gnu.org
2020-04-27 21:53 ` tkoenig at gcc dot gnu.org
2020-04-28 16:23 ` pault at gcc dot gnu.org
2020-05-01 12:53 ` cvs-commit at gcc dot gnu.org
2020-05-01 12:55 ` cvs-commit at gcc dot gnu.org
2020-05-21 10:42 ` tkoenig at gcc dot gnu.org
2021-04-16 16:22 ` tkoenig 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-93956-4-0OurbocYor@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).