public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/99819] [9/10/11/12 Regression] ICE in gfc_defer_symbol_init, at fortran/trans-decl.c:841
Date: Sun, 02 May 2021 17:05:47 +0000	[thread overview]
Message-ID: <bug-99819-4-WlFToM1seS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99819-4@http.gcc.gnu.org/bugzilla/>

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 50735
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50735&action=edit
Experimenta "fix" for the PR

The problem lies in class.c(gfc_build_class_symbol).

The attachment contains two different experiments to test the hypothesis that
the array_spec for 'y' is applied to the _data field of the derived type, which
is then promoted to the main namespace. Subsequently, it is picked up in the
declaration of 'z', which cause the problem.

The first chunk, used by itself, turns the array_spec into a deferred array.
The extent information is lost but the testcase now compiles and runs
(incorrectly!). The second chunk, again by itself, puts the derived type
representation in the function namespace. This now runs the testcase correctly
and does the right thing. However, it can only encompass one such dummy.

I'm onto it:-)

Paul

program p
   type t
      integer :: i
   end type
   class(t), allocatable :: dum1(:), dum2(:)
   allocate (t :: dum1(3), dum2(10))
   dum2%i = [1,2,3,4,5,6,7,8,9,10]
   print *, f(dum1, dum2), g(dum1)
contains
   function g(z)
      class(*) :: z(:)
      type(t) :: u(size(z))
      g = 0
   end
   function f(x, y)
      class(t) :: x(:)
      class(*) :: y(size(x))
      print *, size(y)
      select type (y)
        type is (t)
          f = 1
          if (any (y%i .ne. [1,2,3])) print *, size(y%i)
        class default
          f = 0
      end select
   end
end

  parent reply	other threads:[~2021-05-02 17:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 19:35 [Bug fortran/99819] New: [9/10/11 " gscfq@t-online.de
2021-03-30 13:08 ` [Bug fortran/99819] " rguenth at gcc dot gnu.org
2021-03-30 19:43 ` anlauf at gcc dot gnu.org
2021-05-02 17:05 ` pault at gcc dot gnu.org [this message]
2021-05-04 12:32 ` [Bug fortran/99819] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-05-06 13:44 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:20 ` rguenth at gcc dot gnu.org
2021-08-27 20:44 ` anlauf at gcc dot gnu.org
2021-08-28 18:28 ` cvs-commit at gcc dot gnu.org
2021-08-28 18:30 ` [Bug fortran/99819] [9/10 " anlauf at gcc dot gnu.org
2021-08-30 20:13 ` cvs-commit at gcc dot gnu.org
2021-08-30 20:15 ` [Bug fortran/99819] [9 " anlauf at gcc dot gnu.org
2021-09-06 19:03 ` cvs-commit at gcc dot gnu.org
2021-09-06 19:04 ` 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-99819-4-WlFToM1seS@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).