public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115193] New: using indices with character type within a select type causes ICE
@ 2024-05-22 17:18 ryan.mulhall at noaa dot gov
  2024-05-22 17:22 ` [Bug fortran/115193] " ryan.mulhall at noaa dot gov
  2024-05-22 17:55 ` anlauf at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ryan.mulhall at noaa dot gov @ 2024-05-22 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115193
           Summary: using indices with character type within a select type
                    causes ICE
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.mulhall at noaa dot gov
                CC: thomas.robinson at noaa dot gov, unassigned at gcc dot gnu.org
  Target Milestone: ---

This bug seems to be a regression from past versions, gfortran 10-13 worked
without error.

Bug #100860 describes a similar issue, but gfortran 14.1.0 generates an ICE
while the original issue had a seg fault.

I believe the error is coming from the usage of indices to get a substring from
a class(*) type.

I've simplified the test program from the original report to be more compact:


program test

  implicit none

  character (len=:), allocatable :: str

  str = "examplestring"
  call foo(str,13)

  contains

  subroutine foo(bar, strlen)
    class(*), intent (in)  :: bar
    integer,  intent (in)  :: strlen

    select type (bar)
    type is (character(*))
      print *, 'String is "', bar(1:strlen), '"' ! fails here 
    class default
      print *, "Not the right type"
    end select
  end subroutine

end program test

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

* [Bug fortran/115193] using indices with character type within a select type causes ICE
  2024-05-22 17:18 [Bug fortran/115193] New: using indices with character type within a select type causes ICE ryan.mulhall at noaa dot gov
@ 2024-05-22 17:22 ` ryan.mulhall at noaa dot gov
  2024-05-22 17:55 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ryan.mulhall at noaa dot gov @ 2024-05-22 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ryan Mulhall <ryan.mulhall at noaa dot gov> ---
Error output:


test2.F90:18:43:

   18 |       print *, 'String is "', bar(1:strlen), '"' ! fails here
      |                                           1
internal compiler error: Segmentation fault
0xe5329f crash_signal
        ../.././gcc/toplev.cc:319
0x8ced67 gfc_conv_scalarized_array_ref
        ../.././gcc/fortran/trans-array.cc:3938
0x8cfc46 gfc_conv_array_ref(gfc_se*, gfc_array_ref*, gfc_expr*, locus*)
        ../.././gcc/fortran/trans-array.cc:4094
0x90a946 gfc_conv_variable
        ../.././gcc/fortran/trans-expr.cc:3189
0x90d6c2 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../.././gcc/fortran/trans-expr.cc:9943
0x9336f2 gfc_trans_transfer(gfc_code*)
        ../.././gcc/fortran/trans-io.cc:2609
0x8c48c7 trans_code
        ../.././gcc/fortran/trans.cc:2583
0x9312d9 build_dt
        ../.././gcc/fortran/trans-io.cc:2053
0x8c4827 trans_code
        ../.././gcc/fortran/trans.cc:2555
0x950234 gfc_trans_block_construct(gfc_code*)
        ../.././gcc/fortran/trans-stmt.cc:2377
0x8c4aa7 trans_code
        ../.././gcc/fortran/trans.cc:2459
0x9472dc gfc_trans_select_type_cases
        ../.././gcc/fortran/trans-stmt.cc:3020
0x9519a9 gfc_trans_select_type(gfc_code*)
        ../.././gcc/fortran/trans-stmt.cc:3729
0x8c4a07 trans_code
        ../.././gcc/fortran/trans.cc:2479
0x950234 gfc_trans_block_construct(gfc_code*)
        ../.././gcc/fortran/trans-stmt.cc:2377
0x8c4aa7 trans_code
        ../.././gcc/fortran/trans.cc:2459
0x8f4b24 gfc_generate_function_code(gfc_namespace*)
        ../.././gcc/fortran/trans-decl.cc:7880
0x8f4914 gfc_generate_contained_functions
        ../.././gcc/fortran/trans-decl.cc:5995
0x8f4914 gfc_generate_function_code(gfc_namespace*)
        ../.././gcc/fortran/trans-decl.cc:7812
0x866986 translate_all_program_units
        ../.././gcc/fortran/parse.cc:7099
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug fortran/115193] using indices with character type within a select type causes ICE
  2024-05-22 17:18 [Bug fortran/115193] New: using indices with character type within a select type causes ICE ryan.mulhall at noaa dot gov
  2024-05-22 17:22 ` [Bug fortran/115193] " ryan.mulhall at noaa dot gov
@ 2024-05-22 17:55 ` anlauf at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-05-22 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|wrong-code                  |ice-on-valid-code

--- Comment #2 from anlauf at gcc dot gnu.org ---
This bug has already been reported as pr114874 and just been fixed last week.

*** This bug has been marked as a duplicate of bug 114874 ***

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

end of thread, other threads:[~2024-05-22 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 17:18 [Bug fortran/115193] New: using indices with character type within a select type causes ICE ryan.mulhall at noaa dot gov
2024-05-22 17:22 ` [Bug fortran/115193] " ryan.mulhall at noaa dot gov
2024-05-22 17:55 ` 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).