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

            Bug ID: 128664
           Summary: Interfaces with Assumed-Rank inputs of a user defined
                    type do not allow implicit creation of a user defined
                    type.
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin.pleissa at web dot de
  Target Milestone: ---

Created attachment 66136
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66136&action=edit
Minimal example

I have to follwoing code, where I have an interface with BIND(C) defined
dealing with an assumed-rank array as an input. The type of the assumed-rank
array is user defined. If I call the interface with an intermediate constructed
instance of my user defined type I get an internal compiler error: 

gfortran  -c minimal_ice.f90 
minimal_ice.f90:54:38:

   54 |     r = f(t(2.5))       ! <-- ICE here
      |                                      1
internal compiler error: in fold_convert_loc, at fold-const.cc:2672

This happens for gcc 16.1.0 and gcc 16.2.0. On all older versions I tested,
like gcc 15.3.0 it works properly. 

Searching with git bisect,the commit d0ff10a005eed4ca47d05bc0a93b3daf643025cb
(fortran: remove redundant code related to constant pointer, Oct 29, 2025) is
responsible for this error. Reverting this commit from 16.1.0 or 16.2.0 fixes
the bug. Thus the code was not dead, but not reached by any test case until
now.

Reply via email to