[Bug fortran/127210] New: Internal Compilation error : Mismatch in components of derived type

raphael.monod at wanadoo dot fr gcc-bugzilla@gcc.gnu.org
Fri Sep 4 06:06:08 GMT 2026


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

            Bug ID: 127210
           Summary: Internal Compilation error : Mismatch in components of
                    derived type
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raphael.monod at wanadoo dot fr
  Target Milestone: ---

Created attachment 65497
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65497&action=edit
Minimal reproducer (source code and compilation lines)

Hi,

I encountered a compilation error when performing a partial compilation.

Suppose I have a shared library that I compile first.

Someone then develops a Fortran module, but provides only an SDK containing the
binaries and the .mod files, without the source code. This SDK uses the shared
library.

I then add a new function to the shared library.

Finally, I compile an application using both the shared library (with the new
functions) and the SDK (which only uses the old functions). This fails with an
internal compiler error with GCC 8.5.0 (internal compiler error: in
read_module, at fortran/module.c:5169), and with the following error message
with GCC 12.2.0 and GCC 13.2.0:

Fatal Error: Mismatch in components of derived type
'__vtype_shared_module_My_type' from 'shared_module' at (1): expecting
'my_type_f2', but got 'my_type_f1'
compilation terminated.

Perhaps this can be considered a limitation, but please note that:

The error message refers to a derived type which is never used in my example.
If I remove this derived type, the compilation succeeds.
If I remove one function from the derived type, the compilation succeeds.
If I replace the interfaces with simple functions, the compilation succeeds
with GCC 8.5.0.
I have mainly tested with GCC 8.5.0 and GCC 12.2.0 because these are the
versions available on the Red Hat 8 and Debian 12 systems I use at work.

A minimal reproducer is attached.

Regards,

Raphaël


More information about the Gcc-bugs mailing list