This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix local types handling in OpenMP parallel and task regions (PR middle-end/38633)


Hi!

replace_by_duplicate_decl only handles VAR_DECLs and CONST_DECLs, and
all callers but the new replace_block_vars_by_duplicates ensure that.

Fixed thusly, bootstrapped/regtested on x86_64-linux, committed to trunk.

2008-12-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/38633
	* tree-cfg.c (replace_block_vars_by_duplicates): Only call
	replace_by_duplicate_decl for VAR_DECLs or CONST_DECLs.

	* gcc.dg/gomp/pr38633.c: New test.
	* g++.dg/gomp/pr38633.C: New test.

--- gcc/tree-cfg.c.jj	2008-12-11 09:47:00.000000000 +0100
+++ gcc/tree-cfg.c	2008-12-27 11:36:39.000000000 +0100
@@ -5835,6 +5835,8 @@ replace_block_vars_by_duplicates (tree b
   for (tp = &BLOCK_VARS (block); *tp; tp = &TREE_CHAIN (*tp))
     {
       t = *tp;
+      if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != CONST_DECL)
+	continue;
       replace_by_duplicate_decl (&t, vars_map, to_context);
       if (t != *tp)
 	{
--- gcc/testsuite/gcc.dg/gomp/pr38633.c.jj	2008-12-27 11:41:11.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr38633.c	2008-12-27 11:40:40.000000000 +0100
@@ -0,0 +1,14 @@
+/* PR middle-end/38633 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo ()
+{
+#pragma omp parallel
+  {
+    struct A { int i; } j;
+    j.i = 6;
+    j.i++;
+  }
+}
--- gcc/testsuite/g++.dg/gomp/pr38633.C.jj	2008-12-27 11:41:30.000000000 +0100
+++ gcc/testsuite/g++.dg/gomp/pr38633.C	2008-12-27 11:41:39.000000000 +0100
@@ -0,0 +1,14 @@
+// PR middle-end/38633
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+void
+foo ()
+{
+#pragma omp parallel
+  {
+    struct A { int i; } j;
+    j.i = 6;
+    j.i++;
+  }
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]