public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] Fix ICE in nested-function-1.c testcase
Date: Wed, 29 Jun 2022 14:48:43 +0000 (GMT)	[thread overview]
Message-ID: <20220629144843.4A15C3850206@sourceware.org> (raw)

https://gcc.gnu.org/g:024485073448e1b02d8bf0c652e3b8e196b9fefb

commit 024485073448e1b02d8bf0c652e3b8e196b9fefb
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Fri May 13 16:46:36 2022 +0100

    Fix ICE in nested-function-1.c testcase
    
    The ICE occurs during Gimple verification after the ompexp stage because
    one of the arguments to the generated builtin call is of a Gimple reg type,
    but isn't a Gimple value (because it is marked addressable).
    
    This appears to be fallout from the commit "OpenACC 'kernels' decomposition:
    Mark variables used in synthesized data clauses as addressable [PR100280]".
    The launch dimensions have been added to the arguments of a builtin call
    by oacc_set_fn_attrib, but one of the dimensions has been marked addressable.
    
    Fixed by forcing the added arguments to be re-gimplified.
    
    2022-05-13  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
            gcc/
            * omp-expand.cc (expand_omp_target): Gimplify launch dimensions used
            in function call.

Diff:
---
 gcc/ChangeLog.omp |  5 +++++
 gcc/omp-expand.cc | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 1a9d3c507b5..29740139fd2 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2022-05-13  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* omp-expand.cc (expand_omp_target): Gimplify launch dimensions used
+	in function call.
+
 2022-04-14  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
 	* graphite-oacc.cc (find_oacc_tail_marks): Check that data_dep is
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 1c512b385e8..f228210cc60 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -10274,7 +10274,15 @@ expand_omp_target (struct omp_region *region)
 	  oacc_replace_fn_attrib (child_fn, dims);
 	}
       else
-	oacc_set_fn_attrib (child_fn, clauses, &args);
+	{
+	  unsigned int args_before = args.length ();
+
+	  oacc_set_fn_attrib (child_fn, clauses, &args);
+	  for (unsigned int ix = args_before; ix < args.length (); ix++)
+	    args[ix] = force_gimple_operand_gsi (&gsi, args[ix], true,
+						 NULL_TREE, true,
+						 GSI_SAME_STMT);
+	}
       tagging = true;
       /* FALLTHRU */
     case BUILT_IN_GOACC_ENTER_DATA:


                 reply	other threads:[~2022-06-29 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220629144843.4A15C3850206@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).