riscv: Fix up riscv_atomic_assign_expand_fenv [PR94950]
authorJakub Jelinek <jakub@redhat.com>
Wed, 6 May 2020 07:40:33 +0000 (09:40 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 6 May 2020 07:40:33 +0000 (09:40 +0200)
Similarly to the fixes on many other targets, riscv needs to use TARGET_EXPR
to avoid having the create_tmp_var_raw temporaries without proper DECL_CONTEXT
and not mentioned in local decls.

2020-05-06  Jakub Jelinek  <jakub@redhat.com>

PR target/94950
* config/riscv/riscv-builtins.c (riscv_atomic_assign_expand_fenv): Use
TARGET_EXPR instead of MODIFY_EXPR for first assignment to old_flags.

gcc/ChangeLog
gcc/config/riscv/riscv-builtins.c

index 8040d0d59af0ed1ab7313f725308026f15fc7f91..7a691f28499914b859a1adf1f745549656ad075c 100644 (file)
@@ -1,5 +1,9 @@
 2020-05-06  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/94950
+       * config/riscv/riscv-builtins.c (riscv_atomic_assign_expand_fenv): Use
+       TARGET_EXPR instead of MODIFY_EXPR for first assignment to old_flags.
+
        PR rtl-optimization/94873
        * combine.c (combine_instructions): Don't optimize using REG_EQUAL
        note if SET_SRC (set) has side-effects.
index 201fdb52f20870c40efba1e0330e645de2811b55..a45108e035577b888c7c5e9b5a0acbc68b74ac00 100644 (file)
@@ -283,8 +283,8 @@ riscv_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
   tree fsflags = GET_BUILTIN_DECL (CODE_FOR_riscv_fsflags);
   tree old_flags = create_tmp_var_raw (RISCV_ATYPE_USI);
 
-  *hold = build2 (MODIFY_EXPR, RISCV_ATYPE_USI, old_flags,
-                 build_call_expr (frflags, 0));
+  *hold = build4 (TARGET_EXPR, RISCV_ATYPE_USI, old_flags,
+                 build_call_expr (frflags, 0), NULL_TREE, NULL_TREE);
   *clear = build_call_expr (fsflags, 1, old_flags);
   *update = NULL_TREE;
 }