Big bug in gfortran

Joshua Oliva joshuacoliva@gmail.com
Tue Feb 19 03:07:00 GMT 2019


I can't create an account right now. Just see if the bug can get fixed. i
can't find it anywhere in the list of bugs.
This is just a reduced version of what i am messing around with but it
gives the same error.

procedure(f_sub_inject),pointer::sda=>hsx

print *,"test:",test(sda)

function test(fptr) result(x)
procedure(f_sub_inject),pointer::fptr
character(len=1,kind=c_char),allocatable::x(:)
allocate(x(1))
x(1)="W"
end function test

function f_sub_inject(this,capture) result(z)
use iso_c_binding,only:c_ptr,c_char,c_int
character(len=*),intent(in)::this
character(len=:),allocatable::z
integer(kind=c_int),intent(in)::capture
end function f_sub_inject

function hsx(this,capture) result(z)
use iso_c_binding,only:c_ptr,c_char,c_int
character(len=*),intent(in)::this
character(len=:),allocatable::z
integer(kind=c_int),intent(in)::capture
z=this//"testing"
end function hsx

gives this error

internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.

-----------------------------

If the return on test function is not an allocatable array it works. It
gives an error when i use allocatable on any return it seems like other
than character. When i return an array allocatable in any type it always
gives an error.  I can get this to work as a subroutine without a return
obviously. The problem is when returning arrays and using allocatable with
a procedure as an argument in the same function.

For instance below it gives an error also if you replace the top Test
function with this one. Any allocatable array gives an error with a
procedure in the same function as an argument.
function test(fptr) result(x)
procedure(f_sub_inject),pointer::fptr
integer,allocatable::x(:)
x=[1,2,3,4,5]
end function test

or this
function test(fptr) result(x)
procedure(f_sub_inject),pointer::fptr
integer,allocatable::x
  allocate(x)
x=5
end function test

works with this though

function test(fptr) result(x)
procedure(f_sub_inject),pointer::fptr
character(len=:),allocatable::x
x="testing123"
end function test

internal compiler error: Segmentation fault

Fix it soon if you can. Thanks

Here's my version

gfortran-8 -v
Using built-in specs.
COLLECT_GCC=gfortran-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
8.2.0-1ubuntu2~18.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib
--enable-objc-gc=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Ubuntu 8.2.0-1ubuntu2~18.04)



More information about the Fortran mailing list