diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
commit | 071b4126c613881f4cb25b4e5c39032964827f88 (patch) | |
tree | 7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/omp-expand.cc | |
parent | 845d23f3ea08ba873197c275a8857eee7edad996 (diff) | |
parent | caa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff) | |
download | gcc-devel/gfortran-test.zip gcc-devel/gfortran-test.tar.gz gcc-devel/gfortran-test.tar.bz2 |
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/omp-expand.cc')
-rw-r--r-- | gcc/omp-expand.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index 648ede2..385fe1c 100644 --- a/gcc/omp-expand.cc +++ b/gcc/omp-expand.cc @@ -1895,6 +1895,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, } } bool rect_count_seen = false; + bool init_n2 = SSA_VAR_P (fd->loop.n2) && zero_iter1_bb; for (i = 0; i < (fd->ordered ? fd->ordered : fd->collapse); i++) { tree itype = TREE_TYPE (fd->loops[i].v); @@ -1919,6 +1920,21 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, { gcond *cond_stmt; tree n1, n2; + if (init_n2 && i < fd->collapse && !rect_count_seen) + { + /* When called with non-NULL zero_iter1_bb, we won't clear + fd->loop.n2 in the if (zero_iter_bb == NULL) code below + and if it is prior to storing fd->loop.n2 where + rect_count_seen is set, it could be used uninitialized. + As zero_iter1_bb in that case can be reached also if there + are non-zero iterations, the clearing can't be emitted + to the zero_iter1_bb, but needs to be done before the + condition. */ + gassign *assign_stmt + = gimple_build_assign (fd->loop.n2, build_zero_cst (type)); + gsi_insert_before (gsi, assign_stmt, GSI_SAME_STMT); + init_n2 = false; + } n1 = fold_convert (itype, unshare_expr (fd->loops[i].n1)); n1 = force_gimple_operand_gsi (gsi, n1, true, NULL_TREE, true, GSI_SAME_STMT); |