public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114815] New: internal compiler error: Segmentation fault -  Segmentation Fault - on creating type with len parameter and dependent on it character array
@ 2024-04-22 23:35 dencraft29 at gmail dot com
  2024-04-23  1:15 ` [Bug fortran/114815] internal compiler error: Segmentation fault " kargls at comcast dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dencraft29 at gmail dot com @ 2024-04-22 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114815
           Summary: internal compiler error: Segmentation fault -
                    Segmentation Fault - on creating type with len
                    parameter and dependent on it character array
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dencraft29 at gmail dot com
  Target Milestone: ---

The following code lets gfortran crash: 

program lab_1_4
    type Student_Group(Size)
        integer, len :: Size
        character :: Genders(Size) = ""
    end type Student_Group

    type(Student_Group(22)) :: Group
end program lab_1_4

I have this crash on both my systems:
- GNU Fortran 12.2.0 on Debian 12 (bookworm) 6.1.0.-17-amd64 (virtual machine)
- GNU Fortran 13.2.0 on MacOS on Apple M1 Sonoma 14.4.1 (Homebrew GCC 13.2.0)

When I compile file with provided code, it consistently results in a
segmentation fault. It doesn’t matter what compilation flags I set, it
reproduced always.

Compiler stacktrace:
internal compiler error: Segmentation fault
0x1a22ff6 internal_error(char const*, ...)
        ???:0
0x7ad551 bool wi::lts_p<generic_wide_int<wi::extended_tree<576> >,
generic_wide_int<wi::extended_tree<576> >
>(generic_wide_int<wi::extended_tree<576> > const&,
generic_wide_int<wi::extended_tree<576> > const&)
        ???:0
0x7ace97 gfc_conv_array_initializer(tree_node*, gfc_expr*)
        ???:0
0x7d5cab gfc_conv_initializer(gfc_expr*, gfc_typespec*, tree_node*, bool, bool,
bool)
        ???:0
0x7d6280 gfc_conv_structure(gfc_se*, gfc_expr*, int)
        ???:0
0x7d5e47 gfc_conv_initializer(gfc_expr*, gfc_typespec*, tree_node*, bool, bool,
bool)
        ???:0
0x7bfdc8 gfc_generate_function_code(gfc_namespace*)
        ???:0
0x7388e6 gfc_parse_file()
        ???:0

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

* [Bug fortran/114815] internal compiler error: Segmentation fault - on creating type with len parameter and dependent on it character array
  2024-04-22 23:35 [Bug fortran/114815] New: internal compiler error: Segmentation fault - Segmentation Fault - on creating type with len parameter and dependent on it character array dencraft29 at gmail dot com
@ 2024-04-23  1:15 ` kargls at comcast dot net
  2024-04-24 20:03 ` anlauf at gcc dot gnu.org
  2024-04-24 20:45 ` [Bug fortran/114815] [PDT] " pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargls at comcast dot net @ 2024-04-23  1:15 UTC (permalink / raw)
  To: gcc-bugs

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

kargls at comcast dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargls at comcast dot net

--- Comment #1 from kargls at comcast dot net ---
(In reply to Dmitrii from comment #0)
> The following code lets gfortran crash: 
> 
> program lab_1_4
>     type Student_Group(Size)
>         integer, len :: Size
>         character :: Genders(Size) = ""
>     end type Student_Group
> 
>     type(Student_Group(22)) :: Group
> end program lab_1_4
> 
> I have this crash on both my systems:
> - GNU Fortran 12.2.0 on Debian 12 (bookworm) 6.1.0.-17-amd64 (virtual
> machine)
> - GNU Fortran 13.2.0 on MacOS on Apple M1 Sonoma 14.4.1 (Homebrew GCC 13.2.0)
> 
> When I compile file with provided code, it consistently results in a
> segmentation fault. It doesn’t matter what compilation flags I set, it
> reproduced always.

Parameterized derived types (PDT) are known to have issues.  It is best
to avoid their use with gfortran if you can.

This is likely a duplicate PR, but I no longer have the ability to edit PR
metadata. :(

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

* [Bug fortran/114815] internal compiler error: Segmentation fault - on creating type with len parameter and dependent on it character array
  2024-04-22 23:35 [Bug fortran/114815] New: internal compiler error: Segmentation fault - Segmentation Fault - on creating type with len parameter and dependent on it character array dencraft29 at gmail dot com
  2024-04-23  1:15 ` [Bug fortran/114815] internal compiler error: Segmentation fault " kargls at comcast dot net
@ 2024-04-24 20:03 ` anlauf at gcc dot gnu.org
  2024-04-24 20:45 ` [Bug fortran/114815] [PDT] " pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-04-24 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|                            |2024-04-24
           Priority|P3                          |P4

--- Comment #2 from anlauf at gcc dot gnu.org ---
The code in comment#0 is invalid.

Intel:

pr114815.f90(5): error #8737: For a default initialized component every type
parameter and array bound must be a constant expression.   [GENDERS]
    end type Student_Group
^

NAG:

Error: pr114815.f90, line 4: Type STUDENT_GROUP default-initialised component
GENDERS has a non-constant array bound
Errors in declarations, no further processing for LAB_1_4


When commenting the default initialization, the code compiles with gfortran.

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

* [Bug fortran/114815] [PDT] internal compiler error: Segmentation fault - on creating type with len parameter and dependent on it character array
  2024-04-22 23:35 [Bug fortran/114815] New: internal compiler error: Segmentation fault - Segmentation Fault - on creating type with len parameter and dependent on it character array dencraft29 at gmail dot com
  2024-04-23  1:15 ` [Bug fortran/114815] internal compiler error: Segmentation fault " kargls at comcast dot net
  2024-04-24 20:03 ` anlauf at gcc dot gnu.org
@ 2024-04-24 20:45 ` pault at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pault at gcc dot gnu.org @ 2024-04-24 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to anlauf from comment #2)
> The code in comment#0 is invalid.
> 
> Intel:
> 
> pr114815.f90(5): error #8737: For a default initialized component every type
> parameter and array bound must be a constant expression.   [GENDERS]
>     end type Student_Group
> ^
> 
> NAG:
> 
> Error: pr114815.f90, line 4: Type STUDENT_GROUP default-initialised
> component GENDERS has a non-constant array bound
> Errors in declarations, no further processing for LAB_1_4
> 
> 
> When commenting the default initialization, the code compiles with gfortran.

My first project once 14-branch is released will be to put PDTs to rights.
Unfortunately, the representation is plain wrong and I don't see any point in
cosmetic fixes until that is put right.

Sorry

Paul

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

end of thread, other threads:[~2024-04-24 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 23:35 [Bug fortran/114815] New: internal compiler error: Segmentation fault - Segmentation Fault - on creating type with len parameter and dependent on it character array dencraft29 at gmail dot com
2024-04-23  1:15 ` [Bug fortran/114815] internal compiler error: Segmentation fault " kargls at comcast dot net
2024-04-24 20:03 ` anlauf at gcc dot gnu.org
2024-04-24 20:45 ` [Bug fortran/114815] [PDT] " pault 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).