From 8c601e151937aa6e054363b2c880475c8256756d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 2 May 2024 12:38:34 +0900 Subject: [PATCH] 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 --- 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"