From 50aa16c38821e9cba4fabf6ca4b601b34b84a9c8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 10 Aug 2017 02:33:20 +0200 Subject: re PR c/81687 (Compiler drops label in OpenMP region) PR c/81687 * omp-low.c (omp_copy_decl): Don't remap FORCED_LABEL or DECL_NONLOCAL LABEL_DECLs. * tree-cfg.c (move_stmt_op): Don't adjust DECL_CONTEXT of FORCED_LABEL or DECL_NONLOCAL labels. (move_stmt_r) : Adjust DECL_CONTEXT of FORCED_LABEL or DECL_NONLOCAL labels here. * testsuite/libgomp.c/pr81687-1.c: New test. * testsuite/libgomp.c/pr81687-2.c: New test. From-SVN: r251019 --- libgomp/testsuite/libgomp.c/pr81687-1.c | 23 +++++++++++++++++++++++ libgomp/testsuite/libgomp.c/pr81687-2.c | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 libgomp/testsuite/libgomp.c/pr81687-1.c create mode 100644 libgomp/testsuite/libgomp.c/pr81687-2.c (limited to 'libgomp/testsuite/libgomp.c') diff --git a/libgomp/testsuite/libgomp.c/pr81687-1.c b/libgomp/testsuite/libgomp.c/pr81687-1.c new file mode 100644 index 0000000..768ec44 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr81687-1.c @@ -0,0 +1,23 @@ +/* PR c/81687 */ +/* { dg-do link } */ +/* { dg-additional-options "-O2" } */ + +extern int printf (const char *, ...); + +int +main () +{ + #pragma omp parallel + { + lab1: + printf ("lab1=%p\n", (void *)(&&lab1)); + } + lab2: + #pragma omp parallel + { + lab3: + printf ("lab2=%p\n", (void *)(&&lab2)); + } + printf ("lab3=%p\n", (void *)(&&lab3)); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr81687-2.c b/libgomp/testsuite/libgomp.c/pr81687-2.c new file mode 100644 index 0000000..e819f76 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr81687-2.c @@ -0,0 +1,27 @@ +/* PR c/81687 */ +/* { dg-do link } */ +/* { dg-additional-options "-O2" } */ + +int +main () +{ + __label__ lab4, lab5, lab6; + volatile int l = 0; + int m = l; + void foo (int x) { if (x == 1) goto lab4; } + void bar (int x) { if (x == 2) goto lab5; } + void baz (int x) { if (x == 3) goto lab6; } + #pragma omp parallel + { + foo (m + 1); + lab4:; + } + #pragma omp task + { + bar (m + 2); + lab5:; + } + baz (m + 3); + lab6:; + return 0; +} -- cgit v1.1