diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-10-08 11:10:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-10-08 11:10:34 +0200 |
commit | 273b30c8e93f043f65a04e0ff2ec305b311e98fa (patch) | |
tree | 06fd92384b1ed204c0e4c7a6a5c69714f016422d /gcc/omp-low.c | |
parent | 7345ef6c2a197d0a2581c67838b7ba1650dfad30 (diff) | |
download | gcc-273b30c8e93f043f65a04e0ff2ec305b311e98fa.zip gcc-273b30c8e93f043f65a04e0ff2ec305b311e98fa.tar.gz gcc-273b30c8e93f043f65a04e0ff2ec305b311e98fa.tar.bz2 |
openmp: Set cfun->calls_alloca when needed in OpenMP outlined regions [PR97294]
The following testcase FAILs, because we don't mark the child OpenMP function
as cfun->calls_alloca when it does call alloca. When optimizing, during DCE we
reset those flags and recompute them again, but with -O0 DCE is not performed.
Fixed by calling notice_special_calls when moving insns to the child function.
cfun->calls_alloca is normally set during gimplification and most of the
alloca calls omp-low.c does go through the gimplifier, but one spot didn't
and built the gcall directly, so that one needs to set calls_alloca too.
2020-10-08 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/97294
* tree-cfg.c (move_block_to_fn): Call notice_special_calls on
call stmts being moved into dest_cfun.
* omp-low.c (lower_rec_input_clauses): Set cfun->calls_alloca when
adding __builtin_alloca_with_align call without gimplification.
* gcc.dg/asan/pr97294.c: New test.
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index b054961..b3e2468 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -5112,6 +5112,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, atmp = builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN); stmt = gimple_build_call (atmp, 2, x, size_int (DECL_ALIGN (var))); + cfun->calls_alloca = 1; tmp = create_tmp_var_raw (ptr_type_node); gimple_add_tmp_var (tmp); gimple_call_set_lhs (stmt, tmp); |