Skip to content

Defect: linking error with event post inside associate #648

Open
@rouson

Description

@rouson
  • I am reporting a bug others will be able to reproduce and not asking a question or requesting a new feature.

System information including:

  • OpenCoarrays Version: 2.6.1-14-gb480f1d
  • Fortran Compiler: gfortran 9.0.1 20190318
  • C compiler used for building lib: gcc 9.0.1 20190318
  • Installation method: ./install.sh
  • All flags & options passed to the installer: (none)
  • Output of uname -a: Linux Sourcery-Institute-VM 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • MPI library being used: MPICH 3.2
  • Machine architecture and number of physical cores: 4
  • Version of CMake: 3.13.4

To help us debug your issue please explain:

Compile and link a program that executes event post inside an associate block.

What happened (include command output, screenshots, logs, etc.)

Linking error.

What you expected to happen

I expected the linker to produce an executable program a.out.

Step-by-step reproduction instructions to reproduce the error/bug

$cat link-error.f90 
module link_error
contains
  subroutine post_event_in_associate
    use iso_fortran_env
    type(event_type), save :: e[*]
    associate( i => 1 )
      event post(e[1])
    end associate
  end
end module
end
$caf link-error.f90 
/tmp/ccApG6rc.o: In function `_caf_init.1.3907':
link-error.f90:(.text+0x4d): undefined reference to `caf_token.0.3905'
/tmp/ccApG6rc.o: In function `__link_error_MOD_post_event_in_associate':
link-error.f90:(.text+0x8b): undefined reference to `caf_token.0.3905'
collect2: error: ld returned 1 exit status
Error: comand:
   `/home/rouson/Builds/opt/gnu/9.0.1/bin/gfortran -I/home/rouson/Desktop/Builds/opt/opencoarrays/2.6.1/gnu/9.0.1/include/OpenCoarrays-2.6.1_GNU-9.0.1 -fcoarray=lib -Wl,-rpath -Wl,/home/rouson/Builds/opt/mpich/3.2/gnu/9.0.1/lib -Wl,--enable-new-dtags -L/home/rouson/Desktop/Builds/opt/mpich/3.2/gnu/9.0.1/lib link-error.f90 /home/rouson/Desktop/Builds/opt/opencoarrays/2.6.1/gnu/9.0.1/lib/libcaf_mpi.a /home/rouson/Builds/opt/mpich/3.2/gnu/9.0.1/lib/libmpifort.so /home/rouson/Builds/opt/mpich/3.2/gnu/9.0.1/lib/libmpi.so`
failed to compile.

The linking problem goes away if the use statement and type(event_type) declaration are moved to just after the associate statement and wrapped in block/end block.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions