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

            Bug ID: 88072
           Summary: gfortran crashes with an internal compiler error
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrew at fluidgravity dot co.uk
  Target Milestone: ---

The code below contains an error or two, but instead of reporting a helpful
error message, gfortran crashes with an internal compiler error and segfault:

> gfortran-8 -c code.f90
f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.



pgfortran and ifort are more helpful:

> pgfortran -c code.f90 
PGF90-S-0155-Result is not compatible with parent's result for type bound
procedure f2 (code.f90: 23)
PGF90/x86-64 Linux 18.10-0: compilation completed with severe errors

> ifort -c code.f90
code.f90(13): error #8223: An entity declared with the CLASS keyword shall be a
dummy argument or have the ALLOCATABLE or POINTER attribute.
      FUNCTION f1(this)
---------------^
code.f90(10): error #8280: An overriding binding and its corresponding
overridden binding must both be either subroutines or functions with the same
result type, kind, and shape.   [F]
         PROCEDURE :: f => f2
----------------------^
code.f90(20): warning #6178: The return value of this FUNCTION has not been
defined.   [F2]
      TYPE(t2) FUNCTION f2(this)
------------------------^
compilation aborted for code.f90 (code 1)


code.f90:
MODULE m1
   IMPLICIT NONE
   TYPE, ABSTRACT, PUBLIC :: t1
      INTEGER, DIMENSION(:), ALLOCATABLE :: i
      CONTAINS
         PROCEDURE(f1), DEFERRED :: f
   END TYPE t1
   TYPE, EXTENDS(t1), PUBLIC :: t2
      CONTAINS
         PROCEDURE :: f => f2
   END TYPE t2
   ABSTRACT INTERFACE
      FUNCTION f1(this)
         IMPORT
         CLASS(t1) :: this
         CLASS(t1) :: f1
      END FUNCTION f1
   END INTERFACE
   CONTAINS
      TYPE(t2) FUNCTION f2(this)
         CLASS(t2) :: this
      END FUNCTION f2
END MODULE m1

Reply via email to