Skip to content

Commit c01ab7f

Browse files
authored
Merge branch 'master' into issue-427-fix-sendget
2 parents cbb466f + 8737658 commit c01ab7f

File tree

12 files changed

+2605
-8
lines changed

12 files changed

+2605
-8
lines changed

.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$Format:%d%n%n$
22
# Fall back version, probably last release:
3-
2.0.0
3+
2.1.0
44

55
# OpenCoarrays version file. This project uses semantic
66
# versioning. For details see http://semver.org

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,13 @@ else()
826826
set_property(TEST co_reduce_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
827827
endif()
828828

829+
# Test bash installation scripts
829830
include(cmake/AddInstallationScriptTest.cmake )
830831
add_installation_script_test(installation-scripts.sh src/tests/installation/)
831832

833+
# Test ISO_Fortran_binding library
834+
add_test(NAME ISO_Fortran_binding_tests COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ISO_Fortran_binding_tests")
835+
832836
# Lint the Travis-CI scripts
833837
set(TRAVIS_SCRIPTS
834838
install.linux.sh

prerequisites/build-functions/build_and_install.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# shellcheck shell=bash
12
# Make the build directory, configure, and build
23
# shellcheck disable=SC2154
34

@@ -6,7 +7,6 @@ source "${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/edit_GCC_download_
67

78
build_and_install()
89
{
9-
1010
num_threads=${arg_j}
1111
build_path="${OPENCOARRAYS_SRC_DIR}/prerequisites/builds/${package_to_build}-${version_to_build}"
1212

@@ -45,13 +45,22 @@ build_and_install()
4545

4646
else # ${package_to_build} == "gcc"
4747

48-
# Use GCC's contrib/download_prerequisites script after modifying it, if necessary, to use the
49-
# the preferred download mechanism set in prerequisites/build-functions/set_or_print_downloader.sh
50-
5148
info "pushd ${download_path}/${package_source_directory} "
5249
pushd "${download_path}/${package_source_directory}"
5350

54-
# Switch download mechanism, if wget is not available
51+
# Patch gfortran if necessary
52+
export patches_dir="${OPENCOARRAYS_SRC_DIR}/prerequisites/build-functions/patches/${package_to_build}/${version_to_build}"
53+
if [[ -d "${patches_dir:-}" ]]; then
54+
for patch in "${patches_dir%/}"/*.diff ; do
55+
info "Applying patch ${patch##*/} to $package_to_build ${version_to_build}."
56+
patch -p1 < "$patch"
57+
done
58+
fi
59+
60+
# Use GCC's contrib/download_prerequisites script after modifying it, if necessary, to use the
61+
# the preferred download mechanism set in prerequisites/build-functions/set_or_print_downloader.sh
62+
63+
# Switch download mechanism if wget is not available
5564
edit_GCC_download_prereqs_file_if_necessary
5665

5766
# Download GCC prerequisities
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
2+
index 3e14ddc25d8..a0bbd584947 100644
3+
--- a/gcc/fortran/dependency.c
4+
+++ b/gcc/fortran/dependency.c
5+
@@ -2238,9 +2238,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
6+
break;
7+
8+
/* Exactly matching and forward overlapping ranges don't cause a
9+
- dependency, when they are not part of a coarray ref. */
10+
- if (fin_dep < GFC_DEP_BACKWARD
11+
- && lref->u.ar.codimen == 0 && rref->u.ar.codimen == 0)
12+
+ dependency. */
13+
+ if (fin_dep < GFC_DEP_BACKWARD)
14+
return 0;
15+
16+
/* Keep checking. We only have a dependency if
17+
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
18+
index 00edd447bb2..87b3ca72c05 100644
19+
--- a/gcc/fortran/trans-intrinsic.c
20+
+++ b/gcc/fortran/trans-intrinsic.c
21+
@@ -1860,7 +1860,7 @@ conv_caf_send (gfc_code *code) {
22+
23+
lhs_expr = code->ext.actual->expr;
24+
rhs_expr = code->ext.actual->next->expr;
25+
- may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, false) == 0
26+
+ may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, true) == 0
27+
? boolean_false_node : boolean_true_node;
28+
gfc_init_block (&block);
29+
30+
diff --git a/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90 b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90
31+
new file mode 100644
32+
index 00000000000..dc4cbacba1e
33+
--- /dev/null
34+
+++ b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90
35+
@@ -0,0 +1,11 @@
36+
+! { dg-do compile }
37+
+! { dg-options "-fcoarray=lib -lcaf_single" }
38+
+!
39+
+! Check that reffing x on both sides of a coarray send does not ICE.
40+
+! PR 85507
41+
+
42+
+program check_dependency
43+
+ integer :: x[*]
44+
+ x[42] = x
45+
+end program check_dependency
46+
+
47+
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
48+
index a7567af7b8f..171a27bd4c3 100644
49+
--- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
50+
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
51+
@@ -38,9 +38,8 @@ B(1:5) = B(3:7)
52+
if (any (A-B /= 0)) STOP 4
53+
end
54+
55+
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 0, 0B\\\);" 1 "original" } }
56+
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 1 "original" } }
57+
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 2 "original" } }
58+
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
59+
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
60+
-! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
61+
+! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }

prerequisites/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
# (3) Parse the usage information (default usage file name: current file's name with -usage appended).
3131
# (4) Parse the command line using the usage information.
3232

33-
3433
export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%prerequisites*}}"
3534
export __usage=${OPENCOARRAYS_SRC_DIR}/prerequisites/build.sh-usage
3635
if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(directories_to_build mpi tests)
1+
set(directories_to_build mpi tests iso-fortran-binding)
22
foreach(directory ${directories_to_build})
33
add_subdirectory(${directory})
44
endforeach()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
add_library(ISO_Fortran_binding SHARED ISO_Fortran_binding.c)
2+
add_library(ISO_Fortran_binding_static STATIC ISO_Fortran_binding.c)
3+
4+
set_target_properties(ISO_Fortran_binding_static PROPERTIES OUTPUT_NAME cISO_Fortran_binding)
5+
6+
set(CFI_SO_VERSION 0)
7+
if(gfortran_compiler)
8+
if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0.0)
9+
set(CFI_SO_VERSION 2)
10+
elseif(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8.0.0)
11+
set(CFI_SO_VERSION 1)
12+
endif()
13+
endif()
14+
15+
set_target_properties( ISO_Fortran_binding
16+
PROPERTIES
17+
VERSION ${PROJECT_VERSION}
18+
SOVERSION ${CFI_SO_VERSION}
19+
PUBLIC_HEADER ISO_Fortran_binding.h
20+
)
21+
22+
set_target_properties( ISO_Fortran_binding_static
23+
PROPERTIES
24+
VERSION ${PROJECT_VERSION}
25+
SOVERSION ${CFI_SO_VERSION}
26+
PUBLIC_HEADER ISO_Fortran_binding.h
27+
)
28+
29+
install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING PATTERN "*.h")
30+
31+
install( TARGETS ISO_Fortran_binding
32+
EXPORT OpenCoarraysTargets
33+
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
34+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
35+
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
36+
)
37+
install( TARGETS ISO_Fortran_binding_static
38+
EXPORT OpenCoarraysTargets
39+
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
40+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
41+
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
42+
)

0 commit comments

Comments
 (0)