[gomp] Fix clearing of cfun->eh->region_array in duplicate_eh_regions (PR middle-end/27310)

Jakub Jelinek jakub@redhat.com
Fri Apr 28 10:23:00 GMT 2006


Hi!

Because of this bug, we don't clear num_regions elements, but only
num_regions / sizeof (eh_region) elements.

Ok for trunk?

2006-04-28  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/27310
	* except.c (duplicate_eh_regions): Fix clearing of
	cfun->eh->region_array entries.

	* g++.dg/gomp/pr27310.C: New test.

--- gcc/except.c.jj	2006-04-28 11:58:41.000000000 +0200
+++ gcc/except.c	2006-04-28 11:59:34.000000000 +0200
@@ -956,7 +956,7 @@ duplicate_eh_regions (struct function *i
 
   /* Zero all entries in the range allocated.  */
   memset (VEC_address (eh_region, cfun->eh->region_array)
-	  + cfun_last_region_number + 1, 0, num_regions);
+	  + cfun_last_region_number + 1, 0, num_regions * sizeof (eh_region));
 
   /* Locate the spot at which to insert the new tree.  */
   if (outer_region > 0)
--- gcc/testsuite/g++.dg/gomp/pr27310.C.jj	2006-04-28 12:02:45.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/pr27310.C	2006-04-28 12:02:07.000000000 +0200
@@ -0,0 +1,22 @@
+// PR middle-end/27310
+// { dg-do compile }
+// { dg-options "-O2 -fopenmp" }
+
+struct A
+{
+  ~A ();
+};
+
+struct B
+{
+  A a, b;
+};
+
+void
+foo ()
+{
+  A c, d;
+
+#pragma omp parallel
+  B e;
+}

	Jakub



More information about the Gcc-patches mailing list