diff options
author | Tom de Vries <tdevries@suse.de> | 2019-06-16 07:47:15 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2019-06-16 07:47:15 +0000 |
commit | f45ce17d98fad556e0b534f9a478f5f602c0ad48 (patch) | |
tree | 5b821801cb9880bae3a5f827f3b288ea8c4f4615 /gcc/tree-parloops.c | |
parent | a328e008e860ab7ca75de7d3c55eb83d24849e73 (diff) | |
download | gcc-f45ce17d98fad556e0b534f9a478f5f602c0ad48.zip gcc-f45ce17d98fad556e0b534f9a478f5f602c0ad48.tar.gz gcc-f45ce17d98fad556e0b534f9a478f5f602c0ad48.tar.bz2 |
[openacc, parloops] Fix SIGSEGV in oacc_entry_exit_ok_1
When compiling the test-case with r268755, we run into a SIGSEGV in
oacc_entry_exit_ok_1 when trying to dereference a NULL red:
...
struct reduction_info *red;
red = reduction_phi (reduction_list, use_stmt);
tree val = PHI_RESULT (red->keep_res);
...
Fix this by handling ref == NULL.
Bootstrapped and reg-tested on x86_64.
Build and reg-tested on x86_64 with nvptx accelerator.
2019-06-16 Tom de Vries <tdevries@suse.de>
PR tree-optimization/89376
* tree-parloops.c (oacc_entry_exit_ok_1): Handle red == NULL.
* testsuite/libgomp.oacc-c-c++-common/pr89376.c: New test.
From-SVN: r272338
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r-- | gcc/tree-parloops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 9de154e..6b8c8cd 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -3052,11 +3052,11 @@ oacc_entry_exit_ok_1 (bitmap in_loop_bbs, vec<basic_block> region_bbs, { use_operand_p use_p; gimple *use_stmt; + struct reduction_info *red; single_imm_use (lhs, &use_p, &use_stmt); - if (gimple_code (use_stmt) == GIMPLE_PHI) + if (gimple_code (use_stmt) == GIMPLE_PHI + && (red = reduction_phi (reduction_list, use_stmt))) { - struct reduction_info *red; - red = reduction_phi (reduction_list, use_stmt); tree val = PHI_RESULT (red->keep_res); if (has_single_use (val)) { |