2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 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-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/89621
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-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2019-03-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/89872
+ * gcc.dg/tree-ssa/pr89872.c: New test.
+
2019-03-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/89621
--- /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};
+}