[Bug fortran/126968] New: ICE on invalid use of ASSOCIATE

"jvdelisle at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126968

            Bug ID: 126968
           Summary: ICE on invalid use of ASSOCIATE
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

I think this is new. Found while looking at other issues.

$ cat test.f90
module mib
  type :: ta
     integer :: x = 1
     integer :: pad = 0
  end type
  type :: tb
     real :: junk = 0
     real :: x = 2.5
  end type
end module
program pib
  use mib
  implicit none
  real :: r
  associate (pp => make())
     r = pp%x
  end associate
  print *, r        ! expect 2.5
contains
  function make() result(q)
     type(tb) :: q
  end function
end program

$ gfc test.f90
test.f90:16:13:

   16 |      r = pp%x
      |             1
internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.cc:3010
0x27073df internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:787
0x6aa1f3 fancy_abort(char const*, int, char const*)
        ../../trunk/gcc/diagnostics/context.cc:1813
0x414e6f gfc_conv_component_ref(gfc_se*, gfc_ref*)
        ../../trunk/gcc/fortran/trans-expr.cc:3010
0x85906f gfc_conv_variable
        ../../trunk/gcc/fortran/trans-expr.cc:3461
0x857c96 gfc_conv_expr_val(gfc_se*, gfc_expr*)
        ../../trunk/gcc/fortran/trans-expr.cc:10797
0x8651d7 gfc_conv_intrinsic_function_args
        ../../trunk/gcc/fortran/trans-intrinsic.cc:238
0x86baee gfc_conv_intrinsic_conversion
        ../../trunk/gcc/fortran/trans-intrinsic.cc:296
0x8610a1 gfc_trans_assignment_1
        ../../trunk/gcc/fortran/trans-expr.cc:13445
0x7fe677 trans_code
        ../../trunk/gcc/fortran/trans.cc:2363
0x8b8f6f gfc_trans_block_construct(gfc_code*)
        ../../trunk/gcc/fortran/trans-stmt.cc:2580
0x7fe737 trans_code
        ../../trunk/gcc/fortran/trans.cc:2463
0x83af24 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.cc:8328
0x791e26 translate_all_program_units
        ../../trunk/gcc/fortran/parse.cc:7707
0x791e26 gfc_parse_file()
        ../../trunk/gcc/fortran/parse.cc:8037
0x7fb02f gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.cc:249
/home/jerry/dev/usr/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/f951 test.f90 -quiet
-dumpdir a- -dumpbase test.f90 -dumpbase-ext .f90 -mtune=generic -march=x86-64
-fintrinsic-modules-path
/home/jerry/dev/usr/lib/gcc/x86_64-pc-linux-gnu/17.0.0/finclude
-fpre-include=/usr/include/finclude/math-vector-fortran.h -o /tmp/ccGGl3GY.s
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.