Hi, this patch fixes a problem with if-clauses on kernels, reported by Jim.
It makes sure the condition testing code is generated after the definition of the condition variable.
Bootstrapped on x86_64, committed to gomp-4_0-branch. Thanks, - Tom
Fix if-clause handling for kernels 2015-07-17 Tom de Vries <t...@codesourcery.com> * omp-low.c (expand_omp_target): Fix location of insertion of if-clause handling code. * c-c++-common/goacc/if-clause-2.c: Compile with -Wall. --- gcc/omp-low.c | 3 ++- gcc/testsuite/c-c++-common/goacc/if-clause-2.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 0419dcd..9b062e6 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -9643,7 +9643,8 @@ expand_omp_target (struct omp_region *region) tree tmp_var; tmp_var = create_tmp_var (TREE_TYPE (device)); - if (offloaded) + if (offloaded + && do_splitoff) e = split_block_after_labels (new_bb); else { diff --git a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c index 5ab8459..bf7d6ed 100644 --- a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c +++ b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wall" } */ + void f (short c) { -- 1.9.1