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/103312] [11/12/13/14 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
Date: Wed, 17 Apr 2024 07:10:15 +0000	[thread overview]
Message-ID: <bug-103312-4-uXhDyOHXD9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103312-4@http.gcc.gnu.org/bugzilla/>

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

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 #6 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 57969
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57969&action=edit
Partial fix for the PR

The supplied testcase generates completely blank derived type symbols for the
_vptr component of 'this' in 'func'. The chunk in resolve.cc fixes that.

The rest of the patch allows the full testcase below to blast through to
translation, where it dies in trans-decl.cc - again with blanks symbols in the
default initializer this time.

Of the compilers to which I have access, only NAG succeeds with the full
testcase. If this%size() is replaced with a constant expression or an integer
dummy argument, all compilers succeed, including current versions of gfortran.

I have taken it but need to get on with daytime work for a few days.

Paul

module example

  type, abstract :: foo
    integer :: i
  contains
    procedure(foo_size), deferred :: size
    procedure(foo_func), deferred :: func
  end type

  interface
    function foo_func (this) result (string)
      import :: foo
      class(foo) :: this
      character(this%size()) :: string
    end function
    pure integer function foo_size (this)
      import foo
      class(foo), intent(in) :: this
    end function
  end interface

end module

module extension
  use example
  implicit none
  type, extends(foo) :: bar
!    integer :: i
  contains
    procedure :: size
    procedure :: func
  end type

contains
    pure integer function size (this)
      class(bar), intent(in) :: this
      size = this%i
    end function
    function func (this) result (string)
      class(bar) :: this
      character(this%size()) :: string
      string = repeat ("x", len (string))
    end function

end module

  use example
  use extension
  type(bar) :: a
  a%i = 5
  print *, a%func()
end

  parent reply	other threads:[~2024-04-17  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
2021-11-19 17:15 ` kargl at gcc dot gnu.org
2022-01-17  9:01 ` rguenth at gcc dot gnu.org
2022-05-27  9:46 ` [Bug fortran/103312] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug fortran/103312] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-17  7:10 ` pault at gcc dot gnu.org [this message]
2024-05-18  8:03 ` [Bug fortran/103312] [11/12/13/14/15 " pault at gcc dot gnu.org
2024-05-18  8:05 ` pault at gcc dot gnu.org
2024-05-18  8:09 ` pault at gcc dot gnu.org
2024-05-23  7:00 ` cvs-commit 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-103312-4-uXhDyOHXD9@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).