Skip to content

Fortran: first try if type(*), dimension(..) works as-is #11591

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 34 additions & 27 deletions config/ompi_fortran_check_ignore_tkr.m4
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,22 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
ompi_fortran_ignore_tkr_predecl=!
ompi_fortran_ignore_tkr_type=real

# Vendor-neutral, TYPE(*) syntax
# Vendor-neutral, TYPE(*), DIMENSION(..) syntax
OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!], [type(*)],
[TYPE(*), DIMENSION(*)],
[!], [type(*), DIMENSION(..)],[, ASYNCHRONOUS],
[TYPE(*), DIMENSION(..)],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])
# Vendor-neutral, TYPE(*), DIMENSION(*) syntax
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!], [type(*), DIMENSION(*)],[],
[TYPE(*), DIMENSION(*)],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])

# GCC compilers
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],[],
[!GCC\$ ATTRIBUTES NO_ARG_CHECK],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
# LLVM compilers
Expand All @@ -93,27 +99,27 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
# Intel compilers
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],[],
[!DEC\$ ATTRIBUTES NO_ARG_CHECK],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
# Solaris Studio compilers
# Note that due to a compiler bug, we have been advised by Oracle to
# use the "character(*)" type
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!\$PRAGMA IGNORE_TKR], [character(*)],
[!\$PRAGMA IGNORE_TKR], [character(*)],[],
[!\$PRAGMA IGNORE_TKR],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
# Cray compilers
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!DIR\$ IGNORE_TKR], [real, dimension(*)],
[!DIR\$ IGNORE_TKR], [real, dimension(*)],[],
[!DIR\$ IGNORE_TKR],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])
# IBM compilers
AS_IF([test $internal_ignore_tkr_happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!IBM* IGNORE_TKR], [real, dimension(*)],
[!IBM* IGNORE_TKR], [real, dimension(*)],[],
[!IBM* IGNORE_TKR],
[internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])])

Expand All @@ -132,13 +138,14 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
# functionality
# $1: pre-decl qualifier line -- likely a compiler directive
# $2: parameter type
# $3: message for AC-MSG-CHECKING
# $4: action to take if the test passes
# $5: action to take if the test fails
# $3: asynchronous keyword
# $4: message for AC-MSG-CHECKING
# $5: action to take if the test passes
# $6: action to take if the test fails
AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
OPAL_VAR_SCOPE_PUSH(msg)
AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([for Fortran compiler support of $3])
AC_MSG_CHECKING([for Fortran compiler support of $4])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[!
! Autoconf puts "program main" at the top
implicit none
Expand Down Expand Up @@ -194,35 +201,35 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
end program

subroutine force_assumed_shape(a, count)
implicit none
integer :: count
real, dimension(:,:) :: a
call foo(a, count)
end subroutine force_assumed_shape

module check_ignore_tkr
interface
subroutine foobar(buffer, count)
$1 buffer
$2, intent(in) :: buffer
module mod
interface
subroutine bar(buffer, count)
$2, intent(in)$3 :: buffer
integer, intent(in) :: count
end subroutine foobar
end interface
end subroutine bar
end interface
end module

subroutine bar(var)
use check_ignore_tkr
implicit none
real, intent(inout) :: var(:, :, :)

call foobar(var(1,1,1), 1)
subroutine bogus(buffer, count)
use mod, only : bar
implicit none
$2, intent(in)$3 :: buffer
integer, intent(in) :: count
call bar(buffer, count)
! Autoconf puts "end" after the last line
]]),
[msg=yes
ompi_fortran_ignore_tkr_predecl="$1"
ompi_fortran_ignore_tkr_type="$2"
$4],
$5],
[msg=no
$5])
$6])
AC_MSG_RESULT($msg)
AC_LANG_POP([Fortran])
OPAL_VAR_SCOPE_POP
Expand Down
16 changes: 4 additions & 12 deletions ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
! of Tennessee Research Foundation. All rights
! reserved.
! Copyright (c) 2012 Inria. All rights reserved.
! Copyright (c) 2015-2020 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! Copyright (c) 2015-2023 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved.
! Copyright (c) 2021-2023 Triad National Security, LLC. All rights
! reserved.
Expand Down Expand Up @@ -203,11 +203,7 @@ interface MPI_Precv_init
subroutine MPI_Precv_init_f08(buf,partitions,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_COUNT_KIND
implicit none
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
!$PRAGMA IGNORE_TKR buf
!DIR$ IGNORE_TKR buf
!IBM* IGNORE_TKR buf
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: partitions, dest, tag
INTEGER(MPI_COUNT_KIND), INTENT(IN) :: count
Expand All @@ -222,11 +218,7 @@ interface MPI_Psend_init
subroutine MPI_Psend_init_f08(buf,partitions,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_COUNT_KIND
implicit none
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
!$PRAGMA IGNORE_TKR buf
!DIR$ IGNORE_TKR buf
!IBM* IGNORE_TKR buf
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: partitions, dest, tag
INTEGER(MPI_COUNT_KIND), INTENT(IN) :: count
Expand Down
Loading