+2019-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/89872
+ * gimplify.c (gimplify_compound_literal_expr): Don't optimize a
+ non-addressable complit into its initializer if it is volatile.
+
2019-03-29 Roman Zhuykov <zhroma@ispras.ru>
* opts-common.c (integral_argument): Set errno properly in one case.
otherwise we'd generate a new temporary, and we can as well just
use the decl we already have. */
else if (!TREE_ADDRESSABLE (decl)
+ && !TREE_THIS_VOLATILE (decl)
&& init
&& (fallback & fb_lvalue) == 0
&& gimple_test_f (init))
+2019-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/89872
+ * gcc.dg/tree-ssa/pr89872.c: New test.
+
2019-03-29 Roman Zhuykov <zhroma@ispras.ru>
* gcc.dg/diag-sanity.c: New test.
--- /dev/null
+/* PR c/89872 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " ={v} 1;" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ={v} 2;" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ={v} 3;" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ={v} 4;" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ={v} 0;" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ={v} " 10 "optimized" } } */
+
+void
+foo (void)
+{
+ (volatile int){1} + (volatile int){2};
+}
+
+void
+bar (void)
+{
+ (volatile int){3};
+}
+
+void
+baz (void)
+{
+ (volatile int){4} / (volatile int){0};
+}