https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89376

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Author: vries
Date: Sun Jun 16 07:47:15 2019
New Revision: 272338

URL: https://gcc.gnu.org/viewcvs?rev=272338&root=gcc&view=rev
Log:
[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  <tdevr...@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.

Added:
    trunk/libgomp/testsuite/libgomp.oacc-c-c++-common/pr89376.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-parloops.c
    trunk/libgomp/ChangeLog

Reply via email to