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

            Bug ID: 68676
           Summary: ICE in gfc_match_formal_arglist when compiling
                    gfortran.dg/submodule_10.f08
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---
            Target: alphaev68-linux-gnu

Recent regression on alphaev68-linux-gnu, fails several submodule_??.f08 tests
[1]. The ICE can be triggered with a crosscompiler to alpha-linux-gnu:

~/gcc-build-alpha/gcc/f951 -O submodule_10.f08

f951: internal compiler error: Segmentation fault
0xb19d7f crash_signal
        ../../gcc-svn/trunk/gcc/toplev.c:334
0x5498e5 gfc_match_formal_arglist(gfc_symbol*, int, int)
        ../../gcc-svn/trunk/gcc/fortran/decl.c:4829
0x54c88b gfc_match_subroutine()
        ../../gcc-svn/trunk/gcc/fortran/decl.c:6016
0x5a52f5 decode_statement
        ../../gcc-svn/trunk/gcc/fortran/parse.c:378

gdb session:

Starting program: /home/uros/gcc-build-alpha/gcc/f951 -O submodule_10.f08

Program received signal SIGSEGV, Segmentation fault.
0x00000000005498e5 in gfc_match_formal_arglist (progname=0x175b330, st_flag=0,
null_flag=1) at ../../gcc-svn/trunk/gcc/fortran/decl.c:4829
4829          if (!sym->abr_modproc_decl && formal && !head)
(gdb) p sym
$1 = (gfc_symbol *) 0x0
(gdb) list
4824          if (!formal && head)
4825            arg_count_mismatch = true;
4826
4827          /* Abbreviated module procedure declaration is not meant to have
any
4828             formal arguments!  */
4829          if (!sym->abr_modproc_decl && formal && !head)
4830            arg_count_mismatch = true;
4831
4832          for (p = formal, q = head; p && q; p = p->next, q = q->next)
4833            {
(gdb) bt
#0  0x00000000005498e5 in gfc_match_formal_arglist (progname=0x175b330,
st_flag=0, null_flag=1) at ../../gcc-svn/trunk/gcc/fortran/decl.c:4829
#1  0x000000000054c88c in gfc_match_subroutine () at
../../gcc-svn/trunk/gcc/fortran/decl.c:6016
#2  0x00000000005a52f6 in decode_statement () at
../../gcc-svn/trunk/gcc/fortran/parse.c:378
#3  0x00000000005a6a58 in next_free () at
../../gcc-svn/trunk/gcc/fortran/parse.c:1076
#4  0x00000000005a6de9 in next_statement () at
../../gcc-svn/trunk/gcc/fortran/parse.c:1310
#5  0x00000000005a95af in parse_contained (module=1) at
../../gcc-svn/trunk/gcc/fortran/parse.c:5038
#6  0x00000000005a99ad in parse_module () at
../../gcc-svn/trunk/gcc/fortran/parse.c:5431

sym is dereferenced when NULL.

[1] https://gcc.gnu.org/ml/gcc-testresults/2015-12/msg00267.html

Reply via email to