[Bug fortran/107145] New: Indefinite recursion in gfc_check_dummy_characteristics/gfc_compare_interfaces

asolokha at gmx dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 4 05:18:52 GMT 2022


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

            Bug ID: 107145
           Summary: Indefinite recursion in
                    gfc_check_dummy_characteristics/gfc_compare_interfaces
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gfortran 13.0.0 20220925 snapshot (g:77bbf69d2981dafc2ef3e59bfbefb645d88bab9d)
ICEs when compiling the following testcase, extracted from
test/Semantics/resolve102.f90 from the flang 15.0.1 test suite:

subroutine circular
  procedure(sub) :: p

  call p(sub)

  contains
    subroutine sub(p2)
      procedure(p) :: p2
    end subroutine
end subroutine circular

% gfortran-13.0.0 -c ckmbwiwb.f90
gfortran-13.0.0: internal compiler error: Segmentation fault signal terminated
program f951
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
zsh: exit 4     gfortran-13.0.0 -c ckmbwiwb.f90

(gdb) where 10
#0  gfc_check_dummy_characteristics (s1=0x2e52450, s2=0x2e52450,
type_must_agree=type_must_agree@entry=true,
    errmsg=errmsg@entry=0x7ffffbfff130 "", err_len=err_len@entry=200)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1340
#1  0x00000000008cc6ba in gfc_check_dummy_characteristics (err_len=200,
errmsg=0x7ffffbfff130 "", type_must_agree=true,
    s2=<optimized out>, s1=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1334
#2  gfc_compare_interfaces (s1=<optimized out>, s2=<optimized out>,
name2=0x7ffff79a90d8 "p2", generic_flag=0,
    strict_flag=<optimized out>, errmsg=0x7ffffbfff130 "", err_len=200, p1=0x0,
p2=0x0, bad_result_characteristics=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1825
#3  0x00000000008cd0a7 in gfc_check_dummy_characteristics (s1=0x2e52450,
s2=0x2e52450, type_must_agree=type_must_agree@entry=true,
    errmsg=errmsg@entry=0x7ffffbfff2c0 "", err_len=err_len@entry=200)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1433
#4  0x00000000008cc6ba in gfc_check_dummy_characteristics (err_len=200,
errmsg=0x7ffffbfff2c0 "", type_must_agree=true,
    s2=<optimized out>, s1=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1334
#5  gfc_compare_interfaces (s1=<optimized out>, s2=<optimized out>,
name2=0x7ffff79a90d8 "p2", generic_flag=0,
    strict_flag=<optimized out>, errmsg=0x7ffffbfff2c0 "", err_len=200, p1=0x0,
p2=0x0, bad_result_characteristics=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1825
#6  0x00000000008cd0a7 in gfc_check_dummy_characteristics (s1=0x2e52450,
s2=0x2e52450, type_must_agree=type_must_agree@entry=true,
    errmsg=errmsg@entry=0x7ffffbfff450 "", err_len=err_len@entry=200)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1433
#7  0x00000000008cc6ba in gfc_check_dummy_characteristics (err_len=200,
errmsg=0x7ffffbfff450 "", type_must_agree=true,
    s2=<optimized out>, s1=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1334
#8  gfc_compare_interfaces (s1=<optimized out>, s2=<optimized out>,
name2=0x7ffff79a90d8 "p2", generic_flag=0,
    strict_flag=<optimized out>, errmsg=0x7ffffbfff450 "", err_len=200, p1=0x0,
p2=0x0, bad_result_characteristics=<optimized out>)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1825
#9  0x00000000008cd0a7 in gfc_check_dummy_characteristics (s1=0x2e52450,
s2=0x2e52450, type_must_agree=type_must_agree@entry=true,
    errmsg=errmsg@entry=0x7ffffbfff5e0 "", err_len=err_len@entry=200)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/fortran/interface.cc:1433
(More stack frames follow...)
(gdb) where -1
#503274 0x000000000088004b in main (argc=14, argv=0x7fffffffd9b8)
    at
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/main.cc:39


More information about the Gcc-bugs mailing list