The attached code generates a segfault when compiled with -fbounds-check, even
if there is no bounds violation nor any other error I can see. (indeed if it's
wrong code I'd love to learn why). 
Session log: 
[EMAIL PROTECTED] bugtest]$ gfortran -v 
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2-20061107/configure --prefix=/usr/local/gcc42
--with-
mpfr-dir=/home/sfilippo/COMPILERS/GFORTRAN/TEMP/mpfr-2.2.0
--with-mpfr=/home/sfi
lippo/COMPILERS/GFORTRAN/TEMP/mpfr
--with-gmp-dir=/home/sfilippo/COMPILERS/GFORT
RAN/TEMP/gmp-4.2/ --with-gmp=/home/sfilippo/COMPILERS/GFORTRAN/TEMP/gmp
Thread model: posix
gcc version 4.2.0 20061107 (prerelease)
[EMAIL PROTECTED] bugtest]$ gfortran -o dt_bnd  -ggdb dt_bnd.f90
[EMAIL PROTECTED] bugtest]$ ./dt_bnd
Test case :        1

  Description:
 Base
 Type 2 :           2           4           6           8          10         
1
2          14          16          18          20          22          24       
   26          28          30          32          34          36          38   
       40
 Multilevel: Level No           2
 Multilevel:            5          10          15          20          25       
 30          35          40          45          50          55          60     
     65          70          75          80          85          90          95 
        100


Test case :        2

  Description:
 Base
 Type 2 :           2           4           6           8          10         
1
2          14          16          18          20          22          24       
   26          28          30          32          34          36          38   
       40
 Multilevel: Level No           2
 Multilevel:            5          10          15          20          25       
 30          35          40          45          50          55          60     
     65          70          75          80          85          90          95 
        100


[EMAIL PROTECTED] bugtest]$ gfortran -o dt_bnd  -ggdb -fbounds-check
dt_bnd.f90
[EMAIL PROTECTED] bugtest]$ ./dt_bnd
Test case :        1

Segmentation fault (core dumped)
[EMAIL PROTECTED] bugtest]$ gdb dt_bnd -c core.4828 
GNU gdb Red Hat Linux (6.0post-0.20040223.19rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db
lib
rary "/lib/tls/libthread_db.so.1".

Core was generated by `./dt_bnd'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/gcc42/lib/libgfortran.so.2...done.
Loaded symbols for /usr/local/gcc42/lib/libgfortran.so.2
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /usr/local/gcc42/lib/libgcc_s.so.1...done.
Loaded symbols for /usr/local/gcc42/lib/libgcc_s.so.1
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x08048c5a in __pp_type__dppset ([EMAIL PROTECTED], [EMAIL PROTECTED], 
    [EMAIL PROTECTED], iv=0x0, rs=0x0, rv=0x0, il=0x804d4c4, nl=0x804d4c4, 
    _ptype=2) at dt_bnd.f90:104
104         if (.not.allocated(p%bv(il_)%ipv)) then


-- 
           Summary: segfault with -fbounds-check on allocatable derived type
                    components
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sfilippone at uniroma2 dot it
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to