This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/68927] New: Code aborts in deallocate statement with a stat= specified
- From: "longb at cray dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Dec 2015 00:15:19 +0000
- Subject: [Bug fortran/68927] New: Code aborts in deallocate statement with a stat= specified
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68927
Bug ID: 68927
Summary: Code aborts in deallocate statement with a stat=
specified
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: longb at cray dot com
Target Milestone: ---
> cat test.f90
program test
use,intrinsic :: iso_c_binding
real,target :: x(1000)
real,pointer :: p (:)
type(c_ptr) :: cp
p => x
cp = c_loc(p)
call sub(cp)
end program test
subroutine sub(cp)
use,intrinsic :: iso_c_binding
real,pointer :: p(:)
type(c_ptr) :: cp
integer :: is
call c_f_pointer(cp, p, [1000])
deallocate (p, stat=is)
print *, "deallocate status: ", is
end subroutine sub
> gfortran -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/5.2.0/bin/../snos/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc/5.2.0/snos/libexec/gcc/x86_64-suse-linux/5.2.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../cray-gcc-5.2.0/configure --prefix=/opt/gcc/5.2.0/snos
--disable-nls --libdir=/opt/gcc/5.2.0/snos/lib --enable-languages=c,c++,fortran
--with-gxx-include-dir=/opt/gcc/5.2.0/snos/include/g++
--with-slibdir=/opt/gcc/5.2.0/snos/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit --build=x86_64-suse-linux --with-ppl --with-cloog
Thread model: posix
gcc version 5.2.0 20150716 (Cray Inc.) (GCC)
> gfortran test.f90
> ./a.out
*** glibc detected *** ./a.out: munmap_chunk(): invalid pointer:
0x00007fff69364d90 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x79098)[0x7f5f922e7098]
./a.out[0x4009c6]
./a.out[0x400aab]
./a.out[0x400ae2]
/lib64/libc.so.6(__libc_start_main+0xe6)[0x7f5f9228cc36]
./a.out[0x4007b9]
======= Memory map: ========
[many lines of output deleted]