[Bug fortran/101699] New: [Coarrays] deferred-length character inside a derived type coarray cannot be accessed by coindexing

2021-07-30 Thread harris at sourceryinstitute dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101699

Bug ID: 101699
   Summary: [Coarrays] deferred-length character inside a derived
type coarray cannot be accessed by coindexing
   Product: gcc
   Version: 11.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: harris at sourceryinstitute dot org
  Target Milestone: ---

A deferred-length string inside a derived-type coarray cannot be accessed
correctly by coindexing. This is true even if the coindex is the local image...
The relevant fact seems to be whether or not coindexing is used.

Example: the following program should print "Hello, World!" twice. With
-fcoarray=single, it works correctly. When using -fcoarray=lib (OpenCoarrays
2.9.2), the first print statement works but the second one prints an empty
string.

program main
type :: with_character
character(len=:), allocatable :: chars
end type
type(with_character) :: mailbox[*]

mailbox%chars = "Hello, World!"
print *, mailbox%chars
print *, mailbox[this_image()]%chars
end program

[Bug fortran/101699] [Coarrays] deferred-length character inside a derived type coarray cannot be accessed by coindexing

2021-07-30 Thread harris at sourceryinstitute dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101699

--- Comment #1 from Harris Snyder  ---
Sorry, I neglected to include gfortran version information:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-11.1.1-20210531/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --enable-cet --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.1 20210531 (Red Hat 11.1.1-3) (GCC)

[Bug fortran/101700] New: [Coarrays] segmentation fault calling member function of derived type coarray object on remote image

2021-07-30 Thread harris at sourceryinstitute dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101700

Bug ID: 101700
   Summary: [Coarrays] segmentation fault calling member function
of derived type coarray object on remote image
   Product: gcc
   Version: 11.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: harris at sourceryinstitute dot org
  Target Milestone: ---

A segmentation fault occurs at runtime when using a member function of a
derived type to access an allocatable member variable on a remote image. That's
a lot of words, so it might be easier to explain by example.

The following program should print "1, 2, 3" twice. Instead, image 1 prints "1,
2, 3" but images 2+ crash with a segmentation fault. Note that if you replace
"mailbox[1]%stuff()" with "mailbox[1]%stuff_" then it works correctly.

module container_m
type :: container_t
integer, allocatable :: stuff_(:)
contains
procedure :: stuff
end type
contains
function stuff(self)
class(container_t), intent(in) :: self
integer, allocatable :: stuff(:)
stuff = self%stuff_
end function
end module

program main
use container_m
type(container_t) :: mailbox[*]
if (this_image() == 1) then
allocate(mailbox%stuff_(3))
mailbox%stuff_ = [1, 2, 3]
end if
sync all
print *, mailbox[1]%stuff()
end program



I am using OpenCoarrays 2.9.2 and gfortran 11.1.1:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-11.1.1-20210531/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --enable-cet --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.1 20210531 (Red Hat 11.1.1-3) (GCC)