aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-10-12 11:34:57 +0200
committerRichard Biener <rguenther@suse.de>2023-10-13 08:34:23 +0200
commit6decda1a35be5764101987c210b5693a0d914e58 (patch)
tree901af698616915d43c1c2b177821a3c4b19bc84c /gcc/fortran
parent35b5bb475375dba4ea9101d6db13a6012c4e84ca (diff)
downloadgcc-6decda1a35be5764101987c210b5693a0d914e58.zip
gcc-6decda1a35be5764101987c210b5693a0d914e58.tar.gz
gcc-6decda1a35be5764101987c210b5693a0d914e58.tar.bz2
tree-optimization/111779 - Handle some BIT_FIELD_REFs in SRA
The following handles byte-aligned, power-of-two and byte-multiple sized BIT_FIELD_REF reads in SRA. In particular this should cover BIT_FIELD_REFs created by optimize_bit_field_compare. For gcc.dg/tree-ssa/ssa-dse-26.c we now SRA the BIT_FIELD_REF appearing there leading to more DSE, fully eliding the aggregates. This results in the same false positive -Wuninitialized as the older attempt to remove the folding from optimize_bit_field_compare, fixed by initializing part of the aggregate unconditionally. PR tree-optimization/111779 gcc/ * tree-sra.cc (sra_handled_bf_read_p): New function. (build_access_from_expr_1): Handle some BIT_FIELD_REFs. (sra_modify_expr): Likewise. (make_fancy_name_1): Skip over BIT_FIELD_REF. gcc/fortran/ * trans-expr.cc (gfc_trans_assignment_1): Initialize lhs_caf_attr and rhs_caf_attr codimension flag to avoid false positive -Wuninitialized. gcc/testsuite/ * gcc.dg/tree-ssa/ssa-dse-26.c: Adjust for more DSE. * gcc.dg/vect/vect-pr111779.c: New testcase.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/trans-expr.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 7beefa2..1b8be08 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -12015,7 +12015,10 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
&& !is_runtime_conformable (expr1, expr2);
/* Only analyze the expressions for coarray properties, when in coarray-lib
- mode. */
+ mode. Avoid false-positive uninitialized diagnostics with initializing
+ the codimension flag unconditionally. */
+ lhs_caf_attr.codimension = false;
+ rhs_caf_attr.codimension = false;
if (flag_coarray == GFC_FCOARRAY_LIB)
{
lhs_caf_attr = gfc_caf_attr (expr1, false, &lhs_refs_comp);