From 22fa7850823ae974b4d86d5a2bb2731d55ab1364 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 2 May 2024 10:39:00 +0900 Subject: [PATCH 1/3] configury: harden Fortran ASYNCHRONOUS check LLVM 18 supports the ASYNCHRONOUS keyword in an interface, but not in a subroutine (!) so test both in order to avoid a false positive that will lead to compilation failure. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 8ef1ef836d5f55fcd4f69fde0c7644764c87691b) --- config/ompi_fortran_check_asynchronous.m4 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/ompi_fortran_check_asynchronous.m4 b/config/ompi_fortran_check_asynchronous.m4 index 0cc3c84bfe5..62c53159c50 100644 --- a/config/ompi_fortran_check_asynchronous.m4 +++ b/config/ompi_fortran_check_asynchronous.m4 @@ -11,6 +11,8 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2024 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -35,6 +37,10 @@ SUBROUTINE binky(buf) REAL, DIMENSION(*), ASYNCHRONOUS :: buf END SUBROUTINE END INTERFACE +CONTAINS +SUBROUTINE wookie(buf) + REAL, DIMENSION(*), ASYNCHRONOUS :: buf +END SUBROUTINE END MODULE asynch_mod]])], [AS_VAR_SET(asynchronous_var, yes)], [AS_VAR_SET(asynchronous_var, no)]) From 948d5a4fe6cbd59c0d35970865855476eb2cff2a Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 2 May 2024 12:38:34 +0900 Subject: [PATCH 2/3] configury: harden Fortran IGNORE_TKR check as reported in open-mpi/ompi#12506, upcoming LLVM 19 can generate some false positive that will make the mpi Fortran modules unusable. Harden the test by using a module in order to fix that. Thanks Paul Osmialowski for bringing this to our attention. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 8c601e151937aa6e054363b2c880475c8256756d) --- config/ompi_fortran_check_ignore_tkr.m4 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/config/ompi_fortran_check_ignore_tkr.m4 b/config/ompi_fortran_check_ignore_tkr.m4 index 34d42f90847..29d343575b1 100644 --- a/config/ompi_fortran_check_ignore_tkr.m4 +++ b/config/ompi_fortran_check_ignore_tkr.m4 @@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2024 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -133,6 +135,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [ AC_MSG_CHECKING([for Fortran compiler support of $3]) AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[! ! Autoconf puts "program main" at the top + implicit none interface subroutine force_assumed_shape(a, count) @@ -157,6 +160,7 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [ complex, pointer, dimension(:,:) :: ptr target :: buffer3 integer :: buffer4 + integer :: a ptr => buffer3 ! Set some known values (somewhat irrelevant for this test, but just be @@ -189,8 +193,23 @@ AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [ call foo(a, count) end subroutine force_assumed_shape + module check_ignore_tkr + interface + subroutine foobar(buffer, count) + $1 buffer + $2, intent(in) :: buffer + integer, intent(in) :: count + end subroutine foobar + end interface + end module + + subroutine bar(var) + use check_ignore_tkr + implicit none + real, intent(inout) :: var(:, :, :) + + call foobar(var(1,1,1), 1) ! Autoconf puts "end" after the last line - subroutine bogus ]]), [msg=yes ompi_fortran_ignore_tkr_predecl="$1" From a9c964e38f6e18be6c449617cf3ffbf14ec4410f Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 2 May 2024 12:42:49 +0900 Subject: [PATCH 3/3] configury: add Fortran IGNORE_TKR check for LLVM 19 Try the !DIR$ IGNORE_TKR directive and the type(*) type in order to support upcoming LLVM 19 flang compiler. Thanks Paul Osmialowski for the report and suggesting the solution. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 0bc995fe4cb0015a4072701081331f9a1b3b784a) --- config/ompi_fortran_check_ignore_tkr.m4 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/ompi_fortran_check_ignore_tkr.m4 b/config/ompi_fortran_check_ignore_tkr.m4 index 29d343575b1..3686bca82e8 100644 --- a/config/ompi_fortran_check_ignore_tkr.m4 +++ b/config/ompi_fortran_check_ignore_tkr.m4 @@ -84,6 +84,12 @@ AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [ [!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)], [!GCC\$ ATTRIBUTES NO_ARG_CHECK], [internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])]) + # LLVM compilers + AS_IF([test $internal_ignore_tkr_happy -eq 0], + [OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB( + [!DIR\$ IGNORE_TKR], [type(*)], + [!DIR\$ IGNORE_TKR], + [internal_ignore_tkr_happy=1], [internal_ignore_tkr_happy=0])]) # Intel compilers AS_IF([test $internal_ignore_tkr_happy -eq 0], [OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(