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

            Bug ID: 110585
           Summary: ICE in gfc_compare_expr for findloc with complex
                    literal array
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zed.three at gmail dot com
  Target Milestone: ---

Created attachment 55497
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55497&action=edit
MVCE for findloc ICE with complex literal array

The following MVCE gives an ICE in gfortran 9-13 and trunk:


program mvce
  implicit none
  print*,findloc([(1.0,0.0), (2.0,1.0)], (2.0,0.0))
end program mvce


Backtrace on trunk:


f951: internal compiler error: gfc_compare_expr(): Bad basic type
0xa1a997 gfc_internal_error(char const*, ...)
        ???:0
0x9e0cff gfc_compare_expr(gfc_expr*, gfc_expr*, gfc_intrinsic_op)
        ???:0
0xaba5a9 gfc_simplify_findloc(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*,
gfc_expr*, gfc_expr*)
        ???:0
0xa3ab0a gfc_intrinsic_func_interface(gfc_expr*, int)
        ???:0
0xa9be0b gfc_resolve_code(gfc_code*, gfc_namespace*)
        ???:0
0xa9a9ab gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ???:0
0xa9ac97 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ???:0
0xa84f30 gfc_parse_file()
        ???:0


Compiler Explorer reproducer: https://godbolt.org/z/bdsehGfxc

Changing the first argument to a variable (that is, not a literal array), or
changing the type of the elements and needle to real or integer works fine.

Reply via email to