public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] Fix bug in processing of array dimensions in data clauses.
@ 2021-05-13 16:14 Kwok Yeung
0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8fb217e34984588da26bfcb2981a58625f5ced9f
commit 8fb217e34984588da26bfcb2981a58625f5ced9f
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Tue Mar 31 14:29:09 2020 -0700
Fix bug in processing of array dimensions in data clauses.
The g++ front end wraps the array length and low_bound values in
NON_LVALUE_EXPR, causing the subsequent tests for INTEGER_CST to fail.
The test case c-c++-common/goacc/kernels-loop-annotation-1.c was
tickling this bug and giving bogus errors in g++ because it was falling
through to dynamic array code instead of recognizing the constant bounds.
This patch was posted upstream here
https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542694.html
but not yet committed. It may be that some other fix for this problem
is implemented on mainline instead; check before merging this patch.
2020-03-31 Sandra Loosemore <sandra@codesourcery.com>
gcc/cp/
* semantics.c (handle_omp_array_sections_1): Call STRIP_NOPS
on length and low_bound;
(handle_omp_array_sections): Likewise.
Diff:
---
gcc/cp/ChangeLog.omp | 6 ++++++
gcc/cp/semantics.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 566aaa4d2cf..adc28b921ac 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,9 @@
+2020-03-31 Sandra Loosemore <sandra@codesourcery.com>
+
+ * semantics.c (handle_omp_array_sections_1): Call STRIP_NOPS
+ on length and low_bound;
+ (handle_omp_array_sections): Likewise.
+
2020-03-27 Sandra Loosemore <sandra@codesourcery.com>
* decl.c (cp_unwrap_for_init): New.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 77616cc2efc..16be892c5fa 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5056,6 +5056,10 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
if (length)
length = mark_rvalue_use (length);
/* We need to reduce to real constant-values for checks below. */
+ if (length)
+ STRIP_NOPS (length);
+ if (low_bound)
+ STRIP_NOPS (low_bound);
if (length)
length = fold_simple (length);
if (low_bound)
@@ -5370,6 +5374,11 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
tree low_bound = TREE_PURPOSE (t);
tree length = TREE_VALUE (t);
+ if (length)
+ STRIP_NOPS (length);
+ if (low_bound)
+ STRIP_NOPS (low_bound);
+
i--;
if (low_bound
&& TREE_CODE (low_bound) == INTEGER_CST
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-13 16:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 16:14 [gcc/devel/omp/gcc-11] Fix bug in processing of array dimensions in data clauses Kwok Yeung
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).