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

            Bug ID: 86281
           Summary: [9 regression] SEGV in
                    fortran/resolve.c:resolve_function
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: pault at gcc dot gnu.org
  Target Milestone: ---

Between 20180621 (r261849) and 20180622 (r261880), quite a number of fortran
tests have started FAILing:

+FAIL: gfortran.dg/actual_array_offset_1.f90   -O0  (internal compiler error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O0  (test for excess errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -O0  compilation failed to
produce executable
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O1  (internal compiler error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O1  (test for excess errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -O1  compilation failed to
produce executable
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O2  (internal compiler error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O2  (test for excess errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -O2  compilation failed to
produce executable
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler
error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess
errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to
produce executable
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O3 -g  (internal compiler
error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -O3 -g  (test for excess errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -O3 -g  compilation failed
to produce executable
+FAIL: gfortran.dg/actual_array_offset_1.f90   -Os  (internal compiler error)
+FAIL: gfortran.dg/actual_array_offset_1.f90   -Os  (test for excess errors)
+UNRESOLVED: gfortran.dg/actual_array_offset_1.f90   -Os  compilation failed to
produce executable
+FAIL: gfortran.dg/assumed_charlen_function_7.f90   -O  (test for excess
errors)

+FAIL: gfortran.dg/interface_abstract_4.f90   -O  (internal compiler error)
+FAIL: gfortran.dg/interface_abstract_4.f90   -O  (test for excess errors)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O0  (internal compiler error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O0  (test for excess errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -O0  compilation failed to
produce executable
+FAIL: gfortran.dg/typebound_proc_35.f90   -O1  (internal compiler error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O1  (test for excess errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -O1  compilation failed to
produce executable
+FAIL: gfortran.dg/typebound_proc_35.f90   -O2  (internal compiler error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O2  (test for excess errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -O2  compilation failed to
produce executable
+FAIL: gfortran.dg/typebound_proc_35.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (internal compiler
error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess
errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  compilation failed to
produce executable
+FAIL: gfortran.dg/typebound_proc_35.f90   -O3 -g  (internal compiler error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -O3 -g  (test for excess errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -O3 -g  compilation failed to
produce executable
+FAIL: gfortran.dg/typebound_proc_35.f90   -Os  (internal compiler error)
+FAIL: gfortran.dg/typebound_proc_35.f90   -Os  (test for excess errors)
+UNRESOLVED: gfortran.dg/typebound_proc_35.f90   -Os  compilation failed to
produce executable
+FAIL: gfortran.dg/unlimited_polymorphic_30.f03   -O0  execution test
+FAIL: gfortran.dg/unlimited_polymorphic_30.f03   -O1  execution test

I'm seeing this on 32 and 64-bit Solaris (sparc and x86) and there are also
gcc-testresult reports for i686-pc-linux-gnu, ia64-suse-linux-gnu,
powerpc64-unknown-linux-gnu, x86_64-pc-linux-gnu.

Excess errors:
f951: internal compiler error: Segmentation Fault
0xb29443 crash_signal
        /vol/gcc/src/hg/trunk/local/gcc/toplev.c:324
0x4daed4 resolve_function
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:3119
0x4d7bef gfc_resolve_expr(gfc_expr*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6741
0x4dd90f resolve_compcall
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6299
0x4d8043 resolve_typebound_function
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6408
0x4d8043 gfc_resolve_expr(gfc_expr*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6752
0x4cf32f gfc_resolve_code(gfc_code*, gfc_namespace*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:11133
0x4e06db gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10173
0x4cdf87 gfc_resolve_code(gfc_code*, gfc_namespace*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:11123
0x4d192f resolve_codes
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16581
0x4d18ab resolve_codes
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16565
0x4d1993 gfc_resolve(gfc_namespace*)
        /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16616
0x4bd49b gfc_parse_file()
        /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:6266
0x50a613 gfc_be_parse_file
        /vol/gcc/src/hg/trunk/local/gcc/fortran/f95-lang.c:204

This is probably from

changeset:   46785:567da265136c
user:        pault@138bc75d-0d04-0410-961f-82ee72b054a4
date:        Thu Jun 21 17:34:31 2018 +0000
files:       gcc/fortran/ChangeLog gcc/fortran/resolve.c
gcc/fortran/trans-array.c gcc/fortran/trans-expr.c gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/unlimited_polymorphic_30.f03
description:
2018-06-21  Paul Thomas  <pa...@gcc.gnu.org>

        PR fortran/83118
        * resolve.c (resolve_ordinary_assign): Force the creation of a
[...]

and can be reproduced as easily as

$ f951
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
-quiet

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x08a51345 in resolve_function (expr=expr@entry=0xa058800)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:3118
3118      if (sym && sym->attr.abstract && sym->attr.function
(gdb) where
#0  0x08a51345 in resolve_function (expr=expr@entry=0xa058800)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:3118
#1  0x08a4e5c9 in gfc_resolve_expr (e=0xa058800)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6741
#2  0x08a53a35 in resolve_compcall (e=0xa058800, name=0xfeffd394)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6299
#3  0x08a4ea2f in resolve_typebound_function (e=0xa058800)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6408
#4  gfc_resolve_expr (e=0xa058800)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:6752
#5  0x08a460e5 in gfc_resolve_code (code=<optimized out>, ns=<optimized out>)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:11133
#6  0x08a561ed in gfc_resolve_blocks (b=0xa058510, ns=0xa0569a0)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:10173
#7  0x08a4624c in gfc_resolve_code (code=<optimized out>, ns=<optimized out>)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:11123
#8  0x08a4930a in resolve_codes (ns=ns@entry=0xa0569a0)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16581
#9  0x08a4923e in resolve_codes (ns=ns@entry=0xa044fc0)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16565
#10 0x08a493e3 in gfc_resolve (ns=ns@entry=0xa044fc0)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16616
#11 0x08a56362 in gfc_resolve (ns=0xa044fc0)
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/resolve.c:16601
#12 0x08a37157 in gfc_parse_file ()
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/parse.c:6266
#13 0x08a7ddf6 in gfc_be_parse_file ()
    at /vol/gcc/src/hg/trunk/local/gcc/fortran/f95-lang.c:204
#14 0x09004b4d in compile_file ()
    at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:454
#15 0x09007082 in do_compile ()
    at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:2086
#16 toplev::main(int, char**) ()
    at /vol/gcc/src/hg/trunk/local/gcc/toplev.c:2221
#17 0x0997aba1 in main (argc=3, argv=0xfeffdadc)
    at /vol/gcc/src/hg/trunk/local/gcc/main.c:39

sym->result->ts.u.cl is NULL at that point.  I'm testing the obvious patch
of checking for non-NULL before dereferencing.

  Rainer

Reply via email to