+2015-10-01 Marek Polacek <polacek@redhat.com>
+
+ PR c/65345
+ * config/i386/i386.c (ix86_atomic_assign_expand_fenv): Adjust to use
+ create_tmp_var_raw rather than create_tmp_var.
+
2015-10-01 Marek Polacek <polacek@redhat.com>
PR tree-optimization/67769
{
if (!TARGET_80387 && !TARGET_SSE_MATH)
return;
- tree exceptions_var = create_tmp_var (integer_type_node);
+ tree exceptions_var = create_tmp_var_raw (integer_type_node);
if (TARGET_80387)
{
tree fenv_index_type = build_index_type (size_int (6));
tree fenv_type = build_array_type (unsigned_type_node, fenv_index_type);
- tree fenv_var = create_tmp_var (fenv_type);
- mark_addressable (fenv_var);
+ tree fenv_var = create_tmp_var_raw (fenv_type);
+ TREE_ADDRESSABLE (fenv_var) = 1;
tree fenv_ptr = build_pointer_type (fenv_type);
tree fenv_addr = build1 (ADDR_EXPR, fenv_ptr, fenv_var);
fenv_addr = fold_convert (ptr_type_node, fenv_addr);
tree fnclex = ix86_builtins[IX86_BUILTIN_FNCLEX];
tree hold_fnstenv = build_call_expr (fnstenv, 1, fenv_addr);
tree hold_fnclex = build_call_expr (fnclex, 0);
- *hold = build2 (COMPOUND_EXPR, void_type_node, hold_fnstenv,
+ fenv_var = build4 (TARGET_EXPR, fenv_type, fenv_var, hold_fnstenv,
+ NULL_TREE, NULL_TREE);
+ *hold = build2 (COMPOUND_EXPR, void_type_node, fenv_var,
hold_fnclex);
*clear = build_call_expr (fnclex, 0);
- tree sw_var = create_tmp_var (short_unsigned_type_node);
+ tree sw_var = create_tmp_var_raw (short_unsigned_type_node);
tree fnstsw_call = build_call_expr (fnstsw, 0);
tree sw_mod = build2 (MODIFY_EXPR, short_unsigned_type_node,
sw_var, fnstsw_call);
}
if (TARGET_SSE_MATH)
{
- tree mxcsr_orig_var = create_tmp_var (unsigned_type_node);
- tree mxcsr_mod_var = create_tmp_var (unsigned_type_node);
+ tree mxcsr_orig_var = create_tmp_var_raw (unsigned_type_node);
+ tree mxcsr_mod_var = create_tmp_var_raw (unsigned_type_node);
tree stmxcsr = ix86_builtins[IX86_BUILTIN_STMXCSR];
tree ldmxcsr = ix86_builtins[IX86_BUILTIN_LDMXCSR];
tree stmxcsr_hold_call = build_call_expr (stmxcsr, 0);
+2015-10-01 Marek Polacek <polacek@redhat.com>
+
+ PR c/65345
+ * gcc.dg/atomic/pr65345-4.c: New test.
+ * gcc.dg/pr65345-3.c: New test.
+
2015-10-01 Marek Polacek <polacek@redhat.com>
PR tree-optimization/67769
--- /dev/null
+/* PR c/65345 */
+/* { dg-options "" } */
+
+#define CHECK(X) if (!(X)) __builtin_abort ()
+
+_Atomic float i = 5;
+_Atomic float j = 2;
+
+void
+fn1 (float a[(int) (i = 0)])
+{
+}
+
+void
+fn2 (float a[(int) (i += 2)])
+{
+}
+
+void
+fn3 (float a[(int) ++i])
+{
+}
+
+void
+fn4 (float a[(int) ++i])
+{
+}
+
+void
+fn5 (float a[(int) ++i][(int) (j = 10)])
+{
+}
+
+void
+fn6 (float a[(int) (i = 7)][(int) j--])
+{
+}
+
+int
+main ()
+{
+ float a[10];
+ float aa[10][10];
+ fn1 (a);
+ CHECK (i == 0);
+ fn2 (a);
+ CHECK (i == 2);
+ fn3 (a);
+ CHECK (i == 3);
+ fn4 (a);
+ CHECK (i == 4);
+ fn5 (aa);
+ CHECK (i == 5);
+ CHECK (j == 10);
+ fn6 (aa);
+ CHECK (i == 7);
+ CHECK (j == 9);
+}
--- /dev/null
+/* PR c/65345 */
+/* { dg-options "" } */
+
+_Atomic float i = 3.0f;
+
+float a1 = sizeof (i + 1.2);
+float a2 = sizeof (i = 0);
+float a3 = sizeof (i++);
+float a4 = sizeof (i--);
+float a5 = sizeof (-i);
+
+float b1 = _Alignof (i + 1);
+float b2 = _Alignof (i = 0);
+float b3 = _Alignof (i++);
+float b4 = _Alignof (i--);
+float b5 = _Alignof (-i);
+
+float c1 = i; /* { dg-error "initializer element is not constant" } */
+float c2 = (i ? 1 : 2); /* { dg-error "initializer element is not constant" } */
+float c3[(int) i]; /* { dg-error "variably modified" } */
+float c4 = 0 || i; /* { dg-error "initializer element is not constant" } */
+float c5 = (i += 10); /* { dg-error "initializer element is not constant" } */
+
+_Static_assert (_Generic (i, float: 1, default: 0) == 1, "1");
+_Static_assert (_Generic (i + 1, float: 1, default: 0) == 1, "2");
+_Static_assert (_Generic (i = 0, float: 1, default: 0) == 1, "3");
+_Static_assert (_Generic (i++, float: 1, default: 0) == 1, "4");
+_Static_assert (_Generic (i--, float: 1, default: 0) == 1, "5");
+
+_Atomic int sz = 2;
+void fn1 (float a[sz + 1]);
+void fn2 (float a[sz = 0]);
+void fn3 (float a[sz++]);
+void fn4 (float a[sz--]);
+void fn5 (float a[-sz]);