public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r9-9396] openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]
@ 2021-04-20 23:30 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-04-20 23:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:705afe9b40aabbe395baa2979cdac0a9fef194ef

commit r9-9396-g705afe9b40aabbe395baa2979cdac0a9fef194ef
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 1 21:41:44 2020 +0100

    openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]
    
    Since r11-5430 we ICE on the following testcase.  When parsing the depobj
    directive we don't really use cp_parser_omp_all_clauses routine which ATM
    disables generation of location wrappers and the newly added assertion
    that there are no location wrappers thus triggers.
    
    Fixed by adding the location wrappers suppression sentinel.
    
    Longer term, we should handle location wrappers inside of OpenMP clauses.
    
    2020-12-01  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/98072
            * parser.c (cp_parser_omp_depobj): Suppress location wrappers when
            parsing depend clause.
    
            * c-c++-common/gomp/depobj-2.c: New test.
    
    (cherry picked from commit d62daad11b21a2ee9c39a43c5e94e7b966793dbd)

Diff:
---
 gcc/cp/parser.c                            |  2 ++
 gcc/testsuite/c-c++-common/gomp/depobj-2.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 64dde058dd3..7fda6bb99ba 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -36291,6 +36291,8 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok)
       cp_lexer_consume_token (parser->lexer);
       if (!strcmp ("depend", p))
 	{
+	  /* Don't create location wrapper nodes within the depend clause.  */
+	  auto_suppress_location_wrappers sentinel;
 	  clause = cp_parser_omp_clause_depend (parser, NULL_TREE, c_loc);
 	  if (clause)
 	    clause = finish_omp_clauses (clause, C_ORT_OMP);
diff --git a/gcc/testsuite/c-c++-common/gomp/depobj-2.c b/gcc/testsuite/c-c++-common/gomp/depobj-2.c
new file mode 100644
index 00000000000..d06910c420a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/depobj-2.c
@@ -0,0 +1,11 @@
+/* PR c++/98072 */
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+  char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+void
+foo (int *x, omp_depend_t *y, int z)
+{
+  #pragma omp depobj (*y) depend (in: x[z])
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-20 23:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 23:30 [gcc r9-9396] openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072] Jakub Jelinek

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).