Skip to content

Commit a4a1cc6

Browse files
author
Damian Rouson
authored
Merge pull request #534 from sourceryinstitute/patch-gfortran-8.1.0
install.sh patches gfortran 8.1.0 before building
2 parents 5a250a1 + 2959ddb commit a4a1cc6

File tree

3 files changed

+75
-6
lines changed

3 files changed

+75
-6
lines changed

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

0 commit comments

Comments
 (0)