* [Patch,committed][Fortran] Disable front-end optimization for OpenACC atomic (PR93462)
@ 2020-01-31 16:10 Tobias Burnus
2020-02-03 11:13 ` [committed] Backport to GCC 9: " Tobias Burnus
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2020-01-31 16:10 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
The OpenACC code
!$acc atomic write
a = f(n) - f(n)
got -ffrontend-optimize'd such that it ICEed in gfc_trans_omp_atomic.
The same issue occurred for OpenMP in PR 92977 and was solved by
disabling the optimization for EXEC_OMP_ATOMIC.
This patch does now the same for OpenACC (EXEC_OACC_ATOMIC).
Committed as obvious to the trunk.
Tobias
[-- Attachment #2: committed.diff --]
[-- Type: text/x-patch, Size: 3178 bytes --]
commit 6a97d9eae4543a995f895e6739530f55f5d039a7
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Fri Jan 31 15:54:21 2020 +0100
[Fortran] Disable front-end optimization for OpenACC atomic (PR93462)
PR fortran/93462
* frontend-passes.c (gfc_code_walker): For EXEC_OACC_ATOMIC, set
in_omp_atomic to true prevent front-end optimization.
PR fortran/93462
* gfortran.dg/goacc/atomic-1.f90: New.
---
gcc/fortran/ChangeLog | 16 +++++++++++-----
gcc/fortran/frontend-passes.c | 1 +
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gfortran.dg/goacc/atomic-1.f90 | 17 +++++++++++++++++
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b8f70e6140f..9b17daf15f9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-31 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93462
+ * frontend-passes.c (gfc_code_walker): For EXEC_OACC_ATOMIC, set
+ in_omp_atomic to true prevent front-end optimization.
+
2020-01-30 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
PR fortran/87103
@@ -25,11 +31,11 @@
2020-01-28 Andrew Benson <abensonca@gmail.com>
- PR fortran/93461
- * trans.h: Increase GFC_MAX_MANGLED_SYMBOL_LEN to
- GFC_MAX_SYMBOL_LEN*3+5 to allow for inclusion of submodule name,
- plus the "." between module and submodule names.
- * gfortran.dg/pr93461.f90: New test.
+ PR fortran/93461
+ * trans.h: Increase GFC_MAX_MANGLED_SYMBOL_LEN to
+ GFC_MAX_SYMBOL_LEN*3+5 to allow for inclusion of submodule name,
+ plus the "." between module and submodule names.
+ * gfortran.dg/pr93461.f90: New test.
2020-01-28 Andrew Benson <abensonca@gmail.com>
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index de11524ba14..bbe34d61c99 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -5258,6 +5258,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
WALK_SUBEXPR (co->ext.dt->extra_comma);
break;
+ case EXEC_OACC_ATOMIC:
case EXEC_OMP_ATOMIC:
in_omp_atomic = true;
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8b1dcf23855..f95d2d4e069 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-31 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93462
+ * gfortran.dg/goacc/atomic-1.f90: New.
+
2020-01-31 Tamar Christina <tamar.christina@arm.com>
PR rtl-optimization/91838
diff --git a/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90 b/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90
new file mode 100644
index 00000000000..579f0494b78
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR fortran/93462
+!
+! Contributed by G. Steinmetz
+!
+program p
+ integer :: n = 1
+ integer :: a
+!$acc atomic write
+ a = f(n) - f(n)
+contains
+ integer function f(x)
+ integer, intent(in) :: x
+ f = x
+ end
+end
^ permalink raw reply [flat|nested] 2+ messages in thread
* [committed] Backport to GCC 9: [Patch,committed][Fortran] Disable front-end optimization for OpenACC atomic (PR93462)
2020-01-31 16:10 [Patch,committed][Fortran] Disable front-end optimization for OpenACC atomic (PR93462) Tobias Burnus
@ 2020-02-03 11:13 ` Tobias Burnus
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2020-02-03 11:13 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
And now committed to GCC 9 branch as well.
r10-6403-ge464fc903506b75bef90374ab520b52df317a00e
Tobias
On 1/31/20 3:55 PM, Tobias Burnus wrote:
> The OpenACC code
> !$acc atomic write
> Â Â a = f(n) - f(n)
> got -ffrontend-optimize'd such that it ICEed in gfc_trans_omp_atomic.
>
> The same issue occurred for OpenMP in PR 92977 and was solved by
> disabling the optimization for EXEC_OMP_ATOMIC.
>
> This patch does now the same for OpenACC (EXEC_OACC_ATOMIC).
>
> Committed as obvious to the trunk.
>
> Tobias
>
[-- Attachment #2: committed.diff --]
[-- Type: text/x-patch, Size: 2815 bytes --]
commit e5446f2201d93fc9adc913ed320aa70437ff4235
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Mon Feb 3 12:09:46 2020 +0100
[Fortran] Disable front-end optimization for OpenACC atomic (PR93462)
Backported from mainline
2020-01-31 Tobias Burnus <tobias@codesourcery.com>
PR fortran/93462
* frontend-passes.c (gfc_code_walker): For EXEC_OACC_ATOMIC, set
in_omp_atomic to true prevent front-end optimization.
PR fortran/93462
* gfortran.dg/goacc/atomic-1.f90: New.
---
gcc/fortran/ChangeLog | 9 +++++++++
gcc/fortran/frontend-passes.c | 1 +
gcc/testsuite/ChangeLog | 8 ++++++++
gcc/testsuite/gfortran.dg/goacc/atomic-1.f90 | 17 +++++++++++++++++
4 files changed, 35 insertions(+)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ec87cc9e6cf..ca80c1bcd22 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-03 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from mainline
+ 2020-01-31 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93462
+ * frontend-passes.c (gfc_code_walker): For EXEC_OACC_ATOMIC, set
+ in_omp_atomic to true prevent front-end optimization.
+
2020-02-03 Tobias Burnus <tobias@codesourcery.com>
Backported from mainline
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 4bb6cbb5d74..a6e710beb33 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -5260,6 +5260,7 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
WALK_SUBEXPR (co->ext.dt->extra_comma);
break;
+ case EXEC_OACC_ATOMIC:
case EXEC_OMP_ATOMIC:
in_omp_atomic = true;
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0f8e7592665..e3610fd7429 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-02-03 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from mainline
+ 2020-01-31 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/93462
+ * gfortran.dg/goacc/atomic-1.f90: New.
+
2020-02-03 Tobias Burnus <tobias@codesourcery.com>
Backported from mainline
diff --git a/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90 b/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90
new file mode 100644
index 00000000000..579f0494b78
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/atomic-1.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR fortran/93462
+!
+! Contributed by G. Steinmetz
+!
+program p
+ integer :: n = 1
+ integer :: a
+!$acc atomic write
+ a = f(n) - f(n)
+contains
+ integer function f(x)
+ integer, intent(in) :: x
+ f = x
+ end
+end
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-03 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 16:10 [Patch,committed][Fortran] Disable front-end optimization for OpenACC atomic (PR93462) Tobias Burnus
2020-02-03 11:13 ` [committed] Backport to GCC 9: " Tobias Burnus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).