-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defect: co_broadcast derived type with allocatable components #727
Comments
As @everythingfunctional has pointed out offline, the issue here appears to be mixing a non-
To expose this, we probably just need a simple test with both an |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@rouson @everythingfunctional: It looks like this issue is not yet fixed. Are there plans to fix it in the near future? As you know, there are possible workarounds, but it would be nice to be able to use intrinsic |
@praynaud I'll reopen it and investigate how to turn off the bot that closed this issue. I'll contact you to discuss the status and plan for a fix. |
The original reproducer is as follows: module foo_m
implicit none
type :: foo_t
integer :: i
integer, allocatable :: j(:)
contains
procedure :: broadcast
end type
contains
subroutine broadcast(self, source_image)
class(foo_t), intent(inout) :: self
integer, intent(in) :: source_image
type(foo_t) :: message
integer :: size_j
associate(me => this_image())
if (me == source_image) then
size_j = size(self%j)
end if
call co_broadcast(size_j, source_image)
if (me == source_image) then
message%i = self%i
message%j = self%j
else
allocate(message%j(size_j))
end if
call co_broadcast(message, source_image)
if (me /= source_image) then
self%i = message%i
self%j = message%j
end if
end associate
end subroutine
end module
program main
use foo_m, only: foo_t
implicit none
type(foo_t) :: foo
associate(me => this_image())
if (me == 1) then
foo = foo_t(100, [1,2])
end if
call foo%broadcast(1)
print *, "foo%i = ", foo%i, ", foo%j = ", foo%j, "on image: ", me
end associate
end program and the corresponding output:
|
Test case at: issue-727-co-broadcast-on-mixed-derived-type Unfortunately this is a compiler bug and can not be fixed in the library itself.
|
@rouson Is the next step then to submit a compiler bug to gfortran? |
@praynaud done: see gfortran bug report 103970 @vehre please let us know whether you can work on the compiler fix. |
That would allow me to submit a patch. Doing the PR and patch myself always
feels Abit odd. So when you can file it, I can provide the patch.
|
Well, the patch is nearly done. I just have to do a testcase for the
fortran patch or it won't get accepted.
|
The patch is available at: https://gcc.gnu.org/pipermail/fortran/2022-January/057459.html |
System information including:
uname -a
: Darwin Brads-MBP.lan 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64To help us debug your issue please explain:
What you were trying to do (and why)
Attempting to use
co_broadcast
with a derived type.What happened (include command output, screenshots, logs, etc.)
Not all components are copied correctly.
What you expected to happen
All components should be broadcast to all images.
Step-by-step reproduction instructions to reproduce the error/bug
A minimal reproducer that might serve as a regression test is below:
With 11.2.0, the above code prints, "Test failed."
The text was updated successfully, but these errors were encountered: