[Bug fortran/36751] New: assignment between allocatable arrays of different size causes glibc error

sdirkse at gams dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 7 17:57:00 GMT 2008


If I assign allocatable arrays of different size I get a glibc error and a
backtrace.  This happens with every version of gfortran I've tried, including
4.1, 4.3, and 4.4.  The workaround is easy enough, but perhaps the compiler
could be improved also.  Here's the output:

$gfortran  --version
GNU Fortran (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42)
Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

$gfortran -o repro_g repro.f90  && ./repro_g 
*** glibc detected *** ./repro_g: free(): invalid next size (fast):
0x0000000014d314d0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x359ae71634]
/lib64/libc.so.6(cfree+0x8c)[0x359ae74c5c]
/usr/lib64/libgfortran.so.1(_gfortran_deallocate+0x26)[0x2ad9cffa72a6]
./repro_g[0x4009f4]
./repro_g[0x400a2e]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x359ae1d8b4]
./repro_g[0x400609]
======= Memory map: ========
00400000-00401000 r-xp 00000000 fd:06 5493742                           
/home/steve/lang/f90/repro_g
00600000-00601000 rw-p 00000000 fd:06 5493742                           
/home/steve/lang/f90/repro_g
14d2b000-14d4c000 rw-p 14d2b000 00:00 0 
359aa00000-359aa1a000 r-xp 00000000 fd:00 12636395                      
/lib64/ld-2.5.so
359ac1a000-359ac1b000 r--p 0001a000 fd:00 12636395                      
/lib64/ld-2.5.so
359ac1b000-359ac1c000 rw-p 0001b000 fd:00 12636395                      
/lib64/ld-2.5.so
359ae00000-359af4a000 r-xp 00000000 fd:00 12636396                      
/lib64/libc-2.5.so
359af4a000-359b149000 ---p 0014a000 fd:00 12636396                      
/lib64/libc-2.5.so
359b149000-359b14d000 r--p 00149000 fd:00 12636396                      
/lib64/libc-2.5.so
359b14d000-359b14e000 rw-p 0014d000 fd:00 12636396                      
/lib64/libc-2.5.so
359b14e000-359b153000 rw-p 359b14e000 00:00 0 
359b200000-359b282000 r-xp 00000000 fd:00 12636403                      
/lib64/libm-2.5.so
359b282000-359b481000 ---p 00082000 fd:00 12636403                      
/lib64/libm-2.5.so
359b481000-359b482000 r--p 00081000 fd:00 12636403                      
/lib64/libm-2.5.so
359b482000-359b483000 rw-p 00082000 fd:00 12636403                      
/lib64/libm-2.5.so
35a9c00000-35a9c0d000 r-xp 00000000 fd:00 12636418                      
/lib64/libgcc_s-4.1.2-20080102.so.1
35a9c0d000-35a9e0d000 ---p 0000d000 fd:00 12636418                      
/lib64/libgcc_s-4.1.2-20080102.so.1
35a9e0d000-35a9e0e000 rw-p 0000d000 fd:00 12636418                      
/lib64/libgcc_s-4.1.2-20080102.so.1
2ad9cff7b000-2ad9cff7c000 rw-p 2ad9cff7b000 00:00 0 
2ad9cff95000-2ad9cff96000 rw-p 2ad9cff95000 00:00 0 
2ad9cff96000-2ad9d002c000 r-xp 00000000 fd:00 1293923                   
/usr/lib64/libgfortran.so.1.0.0
2ad9d002c000-2ad9d022b000 ---p 00096000 fd:00 1293923                   
/usr/lib64/libgfortran.so.1.0.0
2ad9d022b000-2ad9d022d000 rw-p 00095000 fd:00 1293923                   
/usr/lib64/libgfortran.so.1.0.0
2ad9d022d000-2ad9d022f000 rw-p 2ad9d022d000 00:00 0 
2ad9d4000000-2ad9d4021000 rw-p 2ad9d4000000 00:00 0 
2ad9d4021000-2ad9d8000000 ---p 2ad9d4021000 00:00 0 
7fffdab19000-7fffdab2f000 rw-p 7fffdab19000 00:00 0                     
[stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0                  [vdso]
Aborted
$


-- 
           Summary: assignment between allocatable arrays of different size
                    causes glibc error
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sdirkse at gams dot com
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-unknown-linux-gnu


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



More information about the Gcc-bugs mailing list