public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3188] openmp, fortran: Fix up IFN_ASSUME call
@ 2022-10-10  7:38 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-10-10  7:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:70f66a47fdf7d5f3837e475175b622abb5b985ad

commit r13-3188-g70f66a47fdf7d5f3837e475175b622abb5b985ad
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Oct 10 09:34:35 2022 +0200

    openmp, fortran: Fix up IFN_ASSUME call
    
    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.
    
    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.

Diff:
---
 gcc/fortran/trans-openmp.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 8ea573f7d02..9bd4e6c7e1b 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -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);

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

only message in thread, other threads:[~2022-10-10  7:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10  7:38 [gcc r13-3188] openmp, fortran: Fix up IFN_ASSUME call 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).