public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/110576] New: ICE on compilation
@ 2023-07-06 16:38 juergen.reuter at desy dot de
  2023-07-11 17:16 ` [Bug fortran/110576] " juergen.reuter at desy dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2023-07-06 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110576
           Summary: ICE on compilation
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

Created attachment 55490
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55490&action=edit
reproducer

The following reproducer leads to an ICE which I see already with gfortran
11.3. It was intended to become a reproducer for the optimization bug in 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110311
but this is a separate issue. I will work around this one in the reproducer for 
110311.
In the most recent master branch, 14.0.0, it leads to
internal compiler error: Segmentation fault
0xd6eabf crash_signal
        ../../gcc/toplev.cc:314
0x7fe2411f151f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x844f2b structure_alloc_comps
        ../../gcc/fortran/trans-array.cc:9228
0x8459bf structure_alloc_comps
        ../../gcc/fortran/trans-array.cc:9167
0x847e8c gfc_deallocate_alloc_comp(gfc_symbol*, tree_node*, int, int)
        ../../gcc/fortran/trans-array.cc:10265
0x86980a gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/fortran/trans-expr.cc:6940
0x8b1952 gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
        ../../gcc/fortran/trans-stmt.cc:424
0x82f93b trans_code
        ../../gcc/fortran/trans.cc:2297
0x8b5c30 gfc_trans_block_construct(gfc_code*)
        ../../gcc/fortran/trans-stmt.cc:2351
0x82f887 trans_code
        ../../gcc/fortran/trans.cc:2325
0x85da69 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:7717
0x833ec1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.cc:2651
0x7d42f5 translate_all_program_units
        ../../gcc/fortran/parse.cc:6914
0x7d42f5 gfc_parse_file()
        ../../gcc/fortran/parse.cc:7233
0x82c6ef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
@ 2023-07-11 17:16 ` juergen.reuter at desy dot de
  2023-07-11 17:19 ` juergen.reuter at desy dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2023-07-11 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jürgen Reuter <juergen.reuter at desy dot de> ---
Created attachment 55525
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55525&action=edit
Simpler reproducer in a single file

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
  2023-07-11 17:16 ` [Bug fortran/110576] " juergen.reuter at desy dot de
@ 2023-07-11 17:19 ` juergen.reuter at desy dot de
  2023-07-11 22:49 ` juergen.reuter at desy dot de
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2023-07-11 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jürgen Reuter <juergen.reuter at desy dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.3.0

--- Comment #2 from Jürgen Reuter <juergen.reuter at desy dot de> ---
This ICE is present since at least gfortran 11.3.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
  2023-07-11 17:16 ` [Bug fortran/110576] " juergen.reuter at desy dot de
  2023-07-11 17:19 ` juergen.reuter at desy dot de
@ 2023-07-11 22:49 ` juergen.reuter at desy dot de
  2023-07-11 22:50 ` juergen.reuter at desy dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2023-07-11 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jürgen Reuter <juergen.reuter at desy dot de> ---
Here is a mininal reproducer:
module process_mci
  implicit none
  private
  public :: process_mci_entry_t

  type :: process_mci_entry_t
     integer :: i_mci = 0
     integer, dimension(:), allocatable :: i_component
     integer :: n_it = 0
  end type process_mci_entry_t

end module process_mci


module pcm_base
  use process_mci, only: process_mci_entry_t

  implicit none
  private
  public :: pcm_t
  public :: pcm_workspace_t

  type, abstract :: pcm_t
     integer :: n_components = 0
     integer :: n_cores = 0
     integer :: n_mci = 0
     logical, dimension(:), allocatable :: component_selected
     logical, dimension(:), allocatable :: component_active
     integer, dimension(:), allocatable :: i_core
     integer, dimension(:), allocatable :: i_mci     
  contains
    procedure(pcm_setup_mci), deferred :: setup_mci
  end type pcm_t

  type, abstract :: pcm_workspace_t
    logical :: bad_point = .false.
  end type pcm_workspace_t

  abstract interface
     subroutine pcm_setup_mci (pcm, mci_entry)
       import
       class(pcm_t), intent(inout) :: pcm
       type(process_mci_entry_t), &
            dimension(:), allocatable, intent(out) :: mci_entry
     end subroutine pcm_setup_mci
  end interface

end module pcm_base


module pcm
  use pcm_base
  use process_mci, only: process_mci_entry_t

  implicit none
  private

  public :: pcm_def_t

  type, extends (pcm_t) :: pcm_def_t
   contains
     procedure :: setup_mci => pcm_def_setup_mci
  end type pcm_def_t

  type, extends (pcm_workspace_t) :: pcm_def_workspace_t
  end type pcm_def_workspace_t

  interface
    module subroutine pcm_def_setup_mci (pcm, mci_entry)
      class(pcm_def_t), intent(inout) :: pcm
      type(process_mci_entry_t), &
           dimension(:), allocatable, intent(out) :: mci_entry
    end subroutine pcm_def_setup_mci
  end interface

end module pcm


submodule (pcm) pcm_s
  use process_mci, only: process_mci_entry_t

  implicit none

contains

  module subroutine pcm_def_setup_mci (pcm, mci_entry)
    class(pcm_def_t), intent(inout) :: pcm
    type(process_mci_entry_t), &
         dimension(:), allocatable, intent(out) :: mci_entry
    integer :: i, i_mci
    allocate (mci_entry (pcm%n_mci))
  end subroutine pcm_def_setup_mci

end submodule pcm_s



module process
  use pcm_base
  use pcm
  use process_mci

  implicit none
  private

  public :: process_t

  type :: process_t
     private
     class(pcm_t), allocatable :: &
          pcm
     type(process_mci_entry_t), dimension(:), allocatable :: &
          mci_entry
   contains
     procedure :: setup_mci => process_setup_mci
  end type process_t


  interface
    module subroutine process_setup_mci (process)
      class(process_t), intent(inout) :: process
    end subroutine process_setup_mci
  end interface

end module process


submodule (process) process_s
  implicit none

contains

  module subroutine process_setup_mci (process)
    class(process_t), intent(inout) :: process
    integer :: i, i_mci
    associate (pcm => process%pcm)
      !!! This triggers the ICE
      call pcm%setup_mci (process%mci_entry)
    end associate
  end subroutine process_setup_mci

end submodule process_s

program main_ut
  implicit none
end program main_ut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
                   ` (2 preceding siblings ...)
  2023-07-11 22:49 ` juergen.reuter at desy dot de
@ 2023-07-11 22:50 ` juergen.reuter at desy dot de
  2023-07-12 19:19 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2023-07-11 22:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jürgen Reuter <juergen.reuter at desy dot de> ---
Created attachment 55526
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55526&action=edit
Minimal reproducer, also as attachment

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
                   ` (3 preceding siblings ...)
  2023-07-11 22:50 ` juergen.reuter at desy dot de
@ 2023-07-12 19:19 ` anlauf at gcc dot gnu.org
  2023-07-12 19:22 ` anlauf at gcc dot gnu.org
  2023-07-12 19:41 ` [Bug fortran/110576] ICE in structure_alloc_comps, at trans-array.cc:9227 anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-07-12 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
                 CC|                            |anlauf at gcc dot gnu.org
   Last reconfirmed|                            |2023-07-12

--- Comment #5 from anlauf at gcc dot gnu.org ---
ICE confirmed for all versions tested (>= 7 ... 14-trunk).

(gdb) l
9222
9223          bool is_pdt_type = c->ts.type == BT_DERIVED
9224                             && c->ts.u.derived->attr.pdt_type;
9225
9226          cdecl = c->backend_decl;
9227          ctype = TREE_TYPE (cdecl);
9228
9229          switch (purpose)
9230            {
9231
(gdb) p c->name
$5 = 0x15555449f100 "i_mci"
(gdb) p c->backend_decl 
$6 = (tree) 0x0

The "i_mci" is a component of type process_mci_entry_t, not a local variable.
This is better seen with a slightly further reduced reproducer.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE on compilation
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
                   ` (4 preceding siblings ...)
  2023-07-12 19:19 ` anlauf at gcc dot gnu.org
@ 2023-07-12 19:22 ` anlauf at gcc dot gnu.org
  2023-07-12 19:41 ` [Bug fortran/110576] ICE in structure_alloc_comps, at trans-array.cc:9227 anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-07-12 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
Created attachment 55533
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55533&action=edit
Slightly more reduced

Commenting out any of the two marked lines avoids the ICE.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/110576] ICE in structure_alloc_comps, at trans-array.cc:9227
  2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
                   ` (5 preceding siblings ...)
  2023-07-12 19:22 ` anlauf at gcc dot gnu.org
@ 2023-07-12 19:41 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-07-12 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE on compilation          |ICE in
                   |                            |structure_alloc_comps, at
                   |                            |trans-array.cc:9227

--- Comment #7 from anlauf at gcc dot gnu.org ---
Adjusting summary to better reflect location of segfault.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-12 19:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 16:38 [Bug fortran/110576] New: ICE on compilation juergen.reuter at desy dot de
2023-07-11 17:16 ` [Bug fortran/110576] " juergen.reuter at desy dot de
2023-07-11 17:19 ` juergen.reuter at desy dot de
2023-07-11 22:49 ` juergen.reuter at desy dot de
2023-07-11 22:50 ` juergen.reuter at desy dot de
2023-07-12 19:19 ` anlauf at gcc dot gnu.org
2023-07-12 19:22 ` anlauf at gcc dot gnu.org
2023-07-12 19:41 ` [Bug fortran/110576] ICE in structure_alloc_comps, at trans-array.cc:9227 anlauf at gcc dot gnu.org

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).