[Bug fortran/126798] New: [17 Regression] 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=126798

            Bug ID: 126798
           Summary: [17 Regression] 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: ---

F2023:C1105 requires that an ASSOCIATE selector be neither a
designator of a procedure pointer nor a function reference that
returns a procedure pointer.  gfortran diagnoses the first case but
not the second, and since GCC 17 it ICEs on it instead.

program p
  associate (a => getp())
  end associate
contains
  function getp() result(r)
    procedure(real), pointer :: r
    r => null()
  end function
end program

gfc new-ice-bug.f90 
new-ice-bug.f90:1:9:

    1 | program p
      |         ^
Error: invalid types in conversion to floating-point
real(kind=4)
real(kind=4) (*<T69d>) ()
a = (real(kind=4)) _1;
new-ice-bug.f90:1:9: internal compiler error: ‘verify_gimple’ failed
0x26f4edf internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:787
0xfa0e6a verify_gimple_in_seq(gimple*, bool)
        ../../trunk/gcc/tree-cfg.cc:5216
0xbda64a gimplify_body(tree_node*, bool)
        ../../trunk/gcc/gimplify.cc:21906
0xbda88e gimplify_function_tree(tree_node*)
        ../../trunk/gcc/gimplify.cc:22032
0x97795f cgraph_node::analyze()
        ../../trunk/gcc/cgraphunit.cc:691
0x97a827 analyze_functions
        ../../trunk/gcc/cgraphunit.cc:1270
0x97b8c2 symbol_table::finalize_compilation_unit()
        ../../trunk/gcc/cgraphunit.cc:2593
/home/jerry/dev/usr/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/f951 new-ice-bug.f90
-quiet -dumpdir a- -dumpbase new-ice-bug.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/ccOCNSgV.s
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.