This one has me quite puzzled. Starting between 2007-10-02 and 2007-10-03, I
haven't been able to bootstrap with Fortran enabled due to an ICE in the
Fortran compiler for very simple testcases:

$ cat foo.f90 
integer function foo ()
end function
$ ./f951 foo.f90
foo.f90:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ ./gfortran -v
Using built-in specs.
Target: i386-pc-linux-gnu
Configured with: ../gfortran_nightbuild/trunk/configure --prefix=/tmp
--with-gmp=/home/fx/gfortran_nightbuild/software --enable-languages=c,fortran
--build=i386-pc-linux-gnu --enable-checking=release
Thread model: posix
gcc version 4.3.0 20071005 (experimental) [trunk revision 129029] (GCC)

This ICE happens all over libgfortran, which is why it breaks bootstrap. All
functions are broken, while subroutines (which return void) work fine. I doubt
that we've broken the Fortran front-end so thouroughly that it can't compile
any function on i386, yet works fine on all other targets (including i686), so
I suppose it is miscompiled. I can get a backtrace:

Program received signal SIGSEGV, Segmentation fault.
build_function_type (value_type=0x0, arg_types=0x0)
    at ../../gfortran_nightbuild/trunk/gcc/tree.c:5787
5787      if (TREE_CODE (value_type) == FUNCTION_TYPE)
(gdb) bt
#0  build_function_type (value_type=0x0, arg_types=0x0)
    at ../../gfortran_nightbuild/trunk/gcc/tree.c:5787
#1  0x080d9564 in gfc_get_function_type (sym=0x86b7860)
    at ../../gfortran_nightbuild/trunk/gcc/fortran/trans-types.c:2039
#2  0x080bd975 in build_function_decl (sym=0x86b7860)
    at ../../gfortran_nightbuild/trunk/gcc/fortran/trans-decl.c:1237
#3  0x080bea12 in gfc_create_function_decl (ns=0x873a4c8)
    at ../../gfortran_nightbuild/trunk/gcc/fortran/trans-decl.c:1793
#4  0x080bfbf8 in gfc_generate_function_code (ns=0x873a4c8)
    at ../../gfortran_nightbuild/trunk/gcc/fortran/trans-decl.c:3139
#5  0x08089b02 in gfc_parse_file ()
    at ../../gfortran_nightbuild/trunk/gcc/fortran/parse.c:3384

but I can't get any further, because gdb becomes crazy:

(gdb) b gfc_sym_type
Breakpoint 1 at 0x80d9288: file
../../gfortran_nightbuild/trunk/gcc/fortran/trans-types.c, line 1539.
(gdb) r
Starting program: /home/fx/ibin/gcc/f951 a.f90
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x80d9288: Input/output error.
Cannot insert breakpoint -3.
Temporarily disabling shared library breakpoints:
breakpoint #-3

The symbol looks OK, but gfc_sym_type() apparently returns a NULL_TREE, which
is not OK. I've followed that code path and function called from there, all the
way down to gfc_get_int_type(), and it looks fine.


-- 
           Summary: Fortran front-end miscompiled?
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33679

Reply via email to