diff mbox

C PATCH for c/65345 (file-scope _Atomic expansion with floats)

Message ID 20151006.072410.428025977.kkojima@rr.iij4u.or.jp
State New
Headers show

Commit Message

Kaz Kojima Oct. 5, 2015, 10:24 p.m. UTC
Marek Polacek <polacek@redhat.com> wrote:
> Joseph reminded me that I had forgotten about this patch.  As mentioned
> here <https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01792.html>, I'm
> removing the XFAILs in the tests so people are likely to see new FAILs.
> 
> I think the following targets will need similar fix as the one below:
[snip]
> * sh

The attached patch is to fix ICEs for new pr65345-[45].c tests
on sh4-unknown-linux-gnu.  It's a mechanical change referring
to the original i386 patch, though I'm not sure the change
for TARGET_EXPR is really needed for SH targets.  I'd like to
apply it anyway, because it fixes the ICEs and there are no
new failures on sh4-unknown-linux-gnu.  Committed.

Regards,
	kaz
--
2015-10-05  Kaz Kojima  <kkojima@gcc.gnu.org>

	PR c/65345
	* config/sh/sh.c (sh_atomic_assign_expand_fenv): Adjust to use
	create_tmp_var_raw rather than create_tmp_var.

Comments

Eric Botcazou Oct. 6, 2015, 8:16 a.m. UTC | #1
> The attached patch is to fix ICEs for new pr65345-[45].c tests
> on sh4-unknown-linux-gnu.  It's a mechanical change referring
> to the original i386 patch, though I'm not sure the change
> for TARGET_EXPR is really needed for SH targets.

No, it is not if you don't need to make the variable addressable.  In any 
case, the failure mode is another ICE in make_decl_rtl so easy to spot.
Kaz Kojima Oct. 6, 2015, 10:01 a.m. UTC | #2
Eric Botcazou <ebotcazou@adacore.com> wrote:
> No, it is not if you don't need to make the variable addressable.  In any 
> case, the failure mode is another ICE in make_decl_rtl so easy to spot.

Thanks for your explanation!  It clarifies the intent of
the original i386 patch.

Regards,
	kaz
diff mbox

Patch

diff --git a/config/sh/sh.c b/config/sh/sh.c
index 904201b..c9c42ba 100644
--- a/config/sh/sh.c
+++ b/config/sh/sh.c
@@ -12109,7 +12109,7 @@  sh_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
 
        __builtin_sh_set_fpscr (masked_fenv);  */
 
-  fenv_var = create_tmp_var (unsigned_type_node);
+  fenv_var = create_tmp_var_raw (unsigned_type_node);
   mask = build_int_cst (unsigned_type_node,
 			~((SH_FE_ALL_EXCEPT << SH_FE_EXCEPT_SHIFT)
 			  | SH_FE_ALL_EXCEPT));
@@ -12117,9 +12117,11 @@  sh_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
 		    fenv_var, build_call_expr (sh_builtin_get_fpscr, 0));
   masked_fenv = build2 (BIT_AND_EXPR, unsigned_type_node, fenv_var, mask);
   hold_fnclex = build_call_expr (sh_builtin_set_fpscr, 1, masked_fenv);
-  *hold = build2 (COMPOUND_EXPR, void_type_node,
-		  build2 (COMPOUND_EXPR, void_type_node, masked_fenv, ld_fenv),
-		  hold_fnclex);
+  fenv_var = build4 (TARGET_EXPR, unsigned_type_node, fenv_var,
+		     build2 (COMPOUND_EXPR, void_type_node, masked_fenv,
+			     ld_fenv),
+		     NULL_TREE, NULL_TREE);
+  *hold = build2 (COMPOUND_EXPR, void_type_node, fenv_var, hold_fnclex);
 
   /* Store the value of masked_fenv to clear the exceptions:
      __builtin_sh_set_fpscr (masked_fenv);  */
@@ -12134,7 +12136,7 @@  sh_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
 
        __atomic_feraiseexcept (new_fenv_var);  */
 
-  new_fenv_var = create_tmp_var (unsigned_type_node);
+  new_fenv_var = create_tmp_var_raw (unsigned_type_node);
   reload_fenv = build2 (MODIFY_EXPR, unsigned_type_node, new_fenv_var,
 			build_call_expr (sh_builtin_get_fpscr, 0));
   restore_fnenv = build_call_expr (sh_builtin_set_fpscr, 1, fenv_var);