[Bug fortran/45848] New: [OOP] ICE on invalid code in fortran/symbol.c:2410

anlauf at gmx dot de gcc-bugzilla@gcc.gnu.org
Thu Sep 30 23:23:00 GMT 2010


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

           Summary: [OOP] ICE on invalid code in fortran/symbol.c:2410
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: anlauf@gmx.de
              Host: i686-pc-linux-gnu


Hi,

the following (invalid) code leads to an ICE:

! Compile with: gfortran -fwhole-file -c gfcbug111.f90
! The "comment line" below appears to have an effect!?

module gfcbug111
!!  use abstract_vector
  implicit none

  type, abstract :: inner_product_class
  end type inner_product_class

  type, extends(inner_product_class) :: trivial_inner_product_type
  end type trivial_inner_product_type

contains

  function my_dot_v_v (this,a,b)
    class(trivial_inner_product_type), intent(in) :: this
    class(vector_class),               intent(in) :: a,b
    real :: my_dot_v_v

    select type (a)
    class is (trivial_vector_type)
       select type (b)
       class is (trivial_vector_type)
       class default
       end select
    class default
    end select
  end function my_dot_v_v
end module gfcbug111


I get:

gfcbug111.f90:18.23:                                                            

    class(vector_class),               intent(in) :: a,b
                       1                                
Error: Derived type 'vector_class' at (1) is being used before it is defined
gfcbug111.f90:22.33:                                                        

    class is (trivial_vector_type)
                                 1
Error: 'trivial_vector_type' at (1) is not an accessible derived type
gfcbug111.f90:23.22:                                                 

       select type (b)
                      1
Error: Expected TYPE IS, CLASS IS or END SELECT statement following SELECT TYPE
at (1)
f951: internal compiler error: Segmentation fault                               

> gdb /opt/gcc/trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951
GNU gdb (GDB; openSUSE 11.1) 6.8.50.20081120-cvs                                
Copyright (C) 2008 Free Software Foundation, Inc.                               
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>   
This is free software: you are free to change and redistribute it.              
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"      
and "show warranty" for details.                                                
This GDB was configured as "i586-suse-linux".                                   
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>...
(gdb) run gfcbug111.f90 -quiet -dumpbase gfcbug111.f90 -mtune=generic
-march=pentiumpro -auxbase gfcbug111 -version -fwhole-file
-fintrinsic-modules-path
/opt/gcc/trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude -o /tmp/ccnYRIzm.s
Starting program: /opt/gcc/trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951
gfcbug111.f90 -quiet -dumpbase gfcbug111.f90 -mtune=generic -march=pentiumpro
-auxbase gfcbug111 -version -fwhole-file -fintrinsic-modules-path
/opt/gcc/trunk/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude -o /tmp/ccnYRIzm.s
GNU Fortran (GCC) version 4.6.0 20100929 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.6.0 20100929 (experimental), GMP version
4.2.3, MPFR version 2.3.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.6.0 20100929 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.6.0 20100929 (experimental), GMP version
4.2.3, MPFR version 2.3.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
gfcbug111.f90:18.23:

    class(vector_class),               intent(in) :: a,b
                       1
Error: Derived type 'vector_class' at (1) is being used before it is defined
gfcbug111.f90:22.33:

    class is (trivial_vector_type)
                                 1
Error: 'trivial_vector_type' at (1) is not an accessible derived type
gfcbug111.f90:23.22:

       select type (b)
                      1
Error: Expected TYPE IS, CLASS IS or END SELECT statement following SELECT TYPE
at (1)

Program received signal SIGSEGV, Segmentation fault.
gfc_find_symtree (st=0x7e1, name=0xbfffe120 "class")
    at ../../trunk/gcc/fortran/symbol.c:2410
2410          c = strcmp (name, st->name);
(gdb) where
#0  gfc_find_symtree (st=0x7e1, name=0xbfffe120 "class")
    at ../../trunk/gcc/fortran/symbol.c:2410
#1  0x08160f8e in gfc_find_sym_tree (name=0xbfffe120 "class", ns=0x8cd9048,
parent_flag=0,
    result=0xbfffe0ec) at ../../trunk/gcc/fortran/symbol.c:2631
#2  0x0816125c in gfc_get_ha_sym_tree (name=0xbfffe120 "class",
result=0xbfffe198)
    at ../../trunk/gcc/fortran/symbol.c:2800
#3  0x0811cdc4 in gfc_match_sym_tree (matched_symbol=0xbfffe198, host_assoc=1)
    at ../../trunk/gcc/fortran/match.c:678
#4  0xbfffe120 in ?? ()
(gdb)


> /opt/gcc/trunk/bin/gfortran -vUsing built-in specs.
COLLECT_GCC=/opt/gcc/trunk/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc/trunk/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../trunk/configure --enable-languages=c,fortran
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk :
(reconfigured) ../trunk/configure --enable-languages=c,fortran
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk :
(reconfigured) ../trunk/configure --enable-languages=c,fortran
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk :
(reconfigured) ../trunk/configure --enable-languages=c,fortran
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk :
(reconfigured) ../trunk/configure --enable-languages=c,fortran
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk :
(reconfigured) ../trunk/configure --with-libelf=/usr/local --with-system-zlib
--prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto --no-create
--no-recursion : (reconfigured) ../trunk/configure --with-libelf=/usr/local
--with-system-zlib --prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto
--no-create --no-recursion : (reconfigured) ../trunk/configure
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk
--enable-languages=c,fortran,lto --no-create --no-recursion : (reconfigured)
../trunk/configure --with-libelf=/usr/local --with-system-zlib
--prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto --no-create
--no-recursion : (reconfigured) ../trunk/configure --with-libelf=/usr/local
--with-system-zlib --prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto
--no-create --no-recursion : (reconfigured) ../trunk/configure
--with-libelf=/usr/local --with-system-zlib --prefix=/opt/gcc/trunk
--enable-languages=c,fortran,lto --no-create --no-recursion : (reconfigured)
../trunk/configure --with-libelf=/usr/local --with-system-zlib
--prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto --no-create
--no-recursion : (reconfigured) ../trunk/configure --with-libelf=/usr/local
--with-system-zlib --prefix=/opt/gcc/trunk --enable-languages=c,fortran,lto
--no-create --no-recursion
Thread model: posix
gcc version 4.6.0 20100929 (experimental) (GCC)


It is funny that if I remove the comment line !! use ...
I get a compiler that appears to compile endlessly...

Cheers,
-ha



More information about the Gcc-bugs mailing list