From: Richard Biener Date: Thu, 11 Jul 2019 07:32:04 +0000 (+0000) Subject: re PR middle-end/91131 (Bad bitfield coalescing) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e66e7b0d1efa3f78a5598884e2d5d526894833e;p=gcc.git re PR middle-end/91131 (Bad bitfield coalescing) 2019-07-11 Richard Biener PR middle-end/91131 * gimplify.c (gimplify_compound_literal_expr): Force a temporary when the object is volatile and we have not cleared it even though there are no nonzero elements. * gcc.target/i386/pr91131.c: New testcase. From-SVN: r273376 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5c05e5e88d..ee70694afeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-11 Richard Biener + + PR middle-end/91131 + * gimplify.c (gimplify_compound_literal_expr): Force a temporary + when the object is volatile and we have not cleared it even though + there are no nonzero elements. + 2019-07-10 Michael Meissner * config/rs6000/predicates.md (cint34_operand): Update diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 239988b56ac..146a86ce588 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5005,7 +5005,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, one field to assign, initialize the target from a temporary. */ if (TREE_THIS_VOLATILE (object) && !TREE_ADDRESSABLE (type) - && num_nonzero_elements > 0 + && (num_nonzero_elements > 0 || !cleared) && vec_safe_length (elts) > 1) { tree temp = create_tmp_var (TYPE_MAIN_VARIANT (type)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7172061a835..efebc7260a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-11 Richard Biener + + PR middle-end/91131 + * gcc.target/i386/pr91131.c: New testcase. + 2019-07-10 Martin Sebor PR testsuite/91132 diff --git a/gcc/testsuite/gcc.target/i386/pr91131.c b/gcc/testsuite/gcc.target/i386/pr91131.c new file mode 100644 index 00000000000..85008ff8a8b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91131.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +struct Reg_T { + unsigned int a : 3; + unsigned int b : 1; + unsigned int c : 4; +}; + +volatile struct Reg_T Reg_A; + +int +main () +{ + Reg_A = (struct Reg_T){ .a = 0, .b = 0, .c = 0 }; + return 0; +} + +/* { dg-final { scan-assembler-times "mov\[^\r\n\]*Reg_A" 1 } } */