public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: [committed] openmp, fortran: Fix up IFN_ASSUME call
Date: Mon, 10 Oct 2022 09:40:14 +0200	[thread overview]
Message-ID: <Y0PMXoRzh+dg/a1n@tucnak> (raw)
In-Reply-To: <81064796-39af-cf76-d551-e990e48920ed@codesourcery.com>

On Thu, Oct 06, 2022 at 06:15:52PM +0200, Tobias Burnus wrote:
> Like as attached? – It did survive regtesting.

Like in other spots in trans-openmp.cc that create a TARGET_EXPR, the
slot has to be created with create_tmp_var_raw, because gfc_create_var
adds the var to BLOCK_VARS and that ICEs during expansion because
gimple_add_tmp_var_fn has:
  gcc_assert (!DECL_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp));
assertion.  Also, both C/C++ ensure the argument to IFN_ASSUME has
boolean_type_node, it is easier if Fortran does that too.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2022-10-10  Jakub Jelinek  <jakub@redhat.com>

	* trans-openmp.cc (gfc_trans_omp_assume): Use create_tmp_var_raw
	instead of gfc_create_var for TARGET_EXPR slot creation.  Create it
	with boolean_type_node and convert.

--- gcc/fortran/trans-openmp.cc.jj	2022-10-07 00:13:12.508191601 +0200
+++ gcc/fortran/trans-openmp.cc	2022-10-09 14:17:55.430364168 +0200
@@ -4588,11 +4588,14 @@ gfc_trans_omp_assume (gfc_code *code)
 	  t = se.expr;
 	else
 	  {
-	    tree var = gfc_create_var (TREE_TYPE (se.expr), NULL);
+	    tree var = create_tmp_var_raw (boolean_type_node);
+	    DECL_CONTEXT (var) = current_function_decl;
 	    stmtblock_t block2;
 	    gfc_init_block (&block2);
 	    gfc_add_block_to_block (&block2, &se.pre);
-	    gfc_add_modify_loc (loc, &block2, var, se.expr);
+	    gfc_add_modify_loc (loc, &block2, var,
+	    			fold_convert_loc (loc, boolean_type_node,
+						  se.expr));
 	    gfc_add_block_to_block (&block2, &se.post);
 	    t = gfc_finish_block (&block2);
 	    t = build4 (TARGET_EXPR, boolean_type_node, var, t, NULL, NULL);

	Jakub


      parent reply	other threads:[~2022-10-10  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 10:55 [Patch] openmp: Map holds clause to IFN_ASSUME for Fortran Tobias Burnus
2022-10-06 12:17 ` Jakub Jelinek
2022-10-06 16:15   ` Tobias Burnus
2022-10-06 16:32     ` Jakub Jelinek
2022-10-10  7:40     ` Jakub Jelinek [this message]

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=Y0PMXoRzh+dg/a1n@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.com \
    /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).