rpms/gcc/devel gcc41-pr27416.patch, 1.2, 1.3 gcc41-pr30421.patch, NONE, 1.1 gcc41-pr30494.patch, NONE, 1.1 .cvsignore, 1.192, 1.193 gcc41.spec, 1.139, 1.140 sources, 1.194, 1.195 gcc41-libgomp-scanrtl.patch, 1.1, NONE gcc41-pr25514.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jan 23 22:13:06 UTC 2007


Author: jakub

Update of /cvs/dist/rpms/gcc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv27178

Modified Files:
	.cvsignore gcc41.spec sources 
Added Files:
	gcc41-pr27416.patch gcc41-pr30421.patch gcc41-pr30494.patch 
Removed Files:
	gcc41-libgomp-scanrtl.patch gcc41-pr25514.patch 
Log Message:
4.1.1-54

gcc41-pr27416.patch:
 gimplify.c                      |   37 +++++++++++++++++++++++++++++++++++++
 testsuite/gcc.dg/gomp/pr27416.c |   31 +++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

Index: gcc41-pr27416.patch
===================================================================
RCS file: gcc41-pr27416.patch
diff -N gcc41-pr27416.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc41-pr27416.patch	23 Jan 2007 22:13:04 -0000	1.3
@@ -0,0 +1,116 @@
+2007-01-23  Jakub Jelinek  <jakub at redhat.com>
+
+	PR middle-end/27416
+	* gimplify.c (omp_check_private): New function.
+	(gimplify_scan_omp_clauses): Use it for
+	firstprivate/lastprivate/reduction.
+
+	* gcc.dg/gomp/pr27416.c: New test.
+
+--- gcc/gimplify.c.jj	2007-01-23 21:21:13.000000000 +0100
++++ gcc/gimplify.c	2007-01-23 21:34:59.000000000 +0100
+@@ -4667,6 +4667,31 @@ omp_is_private (struct gimplify_omp_ctx 
+     return !is_global_var (decl);
+ }
+ 
++/* Return true if DECL is private within a parallel region
++   that binds to the current construct's context or in parallel
++   region's REDUCTION clause.  */
++
++static bool
++omp_check_private (struct gimplify_omp_ctx *ctx, tree decl)
++{
++  splay_tree_node n;
++
++  do
++    {
++      ctx = ctx->outer_context;
++      if (ctx == NULL)
++	return !(is_global_var (decl)
++		 /* References might be private, but might be shared too.  */
++		 || lang_hooks.decls.omp_privatize_by_reference (decl));
++
++      n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
++      if (n != NULL)
++	return (n->value & GOVD_SHARED) == 0;
++    }
++  while (!ctx->is_parallel);
++  return false;
++}
++
+ /* Scan the OpenMP clauses in *LIST_P, installing mappings into a new
+    and previous omp contexts.  */
+ 
+@@ -4685,6 +4710,7 @@ gimplify_scan_omp_clauses (tree *list_p,
+       enum gimplify_status gs;
+       bool remove = false;
+       bool notice_outer = true;
++      const char *check_non_private = NULL;
+       unsigned int flags;
+       tree decl;
+ 
+@@ -4699,12 +4725,15 @@ gimplify_scan_omp_clauses (tree *list_p,
+ 	  goto do_add;
+ 	case OMP_CLAUSE_FIRSTPRIVATE:
+ 	  flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT;
++	  check_non_private = "firstprivate";
+ 	  goto do_add;
+ 	case OMP_CLAUSE_LASTPRIVATE:
+ 	  flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT;
++	  check_non_private = "lastprivate";
+ 	  goto do_add;
+ 	case OMP_CLAUSE_REDUCTION:
+ 	  flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT;
++	  check_non_private = "reduction";
+ 	  goto do_add;
+ 
+ 	do_add:
+@@ -4754,6 +4783,14 @@ gimplify_scan_omp_clauses (tree *list_p,
+ 	do_notice:
+ 	  if (outer_ctx)
+ 	    omp_notice_variable (outer_ctx, decl, true);
++	  if (check_non_private
++	      && !in_parallel
++	      && omp_check_private (ctx, decl))
++	    {
++	      error ("%s variable %qs is private in outer context",
++		     check_non_private, IDENTIFIER_POINTER (DECL_NAME (decl)));
++	      remove = true;
++	    }
+ 	  break;
+ 
+ 	case OMP_CLAUSE_IF:
+--- gcc/testsuite/gcc.dg/gomp/pr27416.c.jj	2007-01-23 21:26:51.000000000 +0100
++++ gcc/testsuite/gcc.dg/gomp/pr27416.c	2007-01-23 21:26:12.000000000 +0100
+@@ -0,0 +1,31 @@
++/* PR middle-end/27416 */
++/* { dg-do compile } */
++
++void
++foo (void)
++{
++  int i = 0, j = 0;
++#pragma omp for firstprivate (j) /* { dg-error "is private in outer context" } */
++  for (i = 0; i < 10; i++)
++    j++;
++}
++
++int
++bar (void)
++{
++  int i, j;
++#pragma omp for lastprivate (j)	/* { dg-error "is private in outer context" } */
++  for (i = 0; i < 10; i++)
++    j = i;
++  return j;
++}
++
++int
++baz (void)
++{
++  int i, j = 0;
++#pragma omp for reduction (+:j)	/* { dg-error "is private in outer context" } */
++  for (i = 0; i < 10; i++)
++    j++;
++  return j;
++}

gcc41-pr30421.patch:
 omp-low.c                       |   31 +++++++++++++++++++++++++------
 testsuite/gcc.dg/gomp/pr30421.c |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 6 deletions(-)

--- NEW FILE gcc41-pr30421.patch ---
2007-01-18  Jakub Jelinek  <jakub at redhat.com>

	PR middle-end/30421
	* omp-low.c (lower_omp_for_lastprivate): Add dlist argument.
	If lower_lastprivate_clauses emits some statements, append them
	to dlist rather than body_p and to body_p append an initializer.
	(lower_omp_for): Adjust caller.

	* gcc.dg/gomp/pr30421.c: New test.

--- gcc/omp-low.c.jj	2007-01-17 16:07:41.000000000 +0100
+++ gcc/omp-low.c	2007-01-18 19:26:05.000000000 +0100
@@ -1601,7 +1601,7 @@ omp_reduction_init (tree clause, tree ty
 
 static void
 lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
-			  omp_context *ctx)
+			 omp_context *ctx)
 {
   tree_stmt_iterator diter;
   tree c, dtor, copyin_seq, x, args, ptr;
@@ -3986,13 +3986,14 @@ lower_omp_critical (tree *stmt_p, omp_co
 /* A subroutine of lower_omp_for.  Generate code to emit the predicate
    for a lastprivate clause.  Given a loop control predicate of (V
    cond N2), we gate the clause on (!(V cond N2)).  The lowered form
-   is appended to *BODY_P.  */
+   is appended to *DLIST, iterator initialization is appended to
+   *BODY_P.  */
 
 static void
 lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p,
-			   struct omp_context *ctx)
+			   tree *dlist, struct omp_context *ctx)
 {
-  tree clauses, cond;
+  tree clauses, cond, stmts, vinit, t;
   enum tree_code cond_code;
   
   cond_code = fd->cond_code;
@@ -4010,7 +4011,24 @@ lower_omp_for_lastprivate (struct omp_fo
   cond = build2 (cond_code, boolean_type_node, fd->v, fd->n2);
 
   clauses = OMP_FOR_CLAUSES (fd->for_stmt);
-  lower_lastprivate_clauses (clauses, cond, body_p, ctx);
+  stmts = NULL;
+  lower_lastprivate_clauses (clauses, cond, &stmts, ctx);
+  if (stmts != NULL)
+    {
+      append_to_statement_list (stmts, dlist);
+
+      /* Optimize: v = 0; is usually cheaper than v = some_other_constant.  */
+      vinit = fd->n1;
+      if (cond_code == EQ_EXPR
+	  && host_integerp (fd->n2, 0)
+	  && ! integer_zerop (fd->n2))
+	vinit = build_int_cst (TREE_TYPE (fd->v), 0);
+
+      /* Initialize the iterator variable, so that threads that don't execute
+	 any iterations don't execute the lastprivate clauses by accident.  */
+      t = build2 (GIMPLE_MODIFY_STMT, void_type_node, fd->v, vinit);
+      gimplify_and_add (t, body_p);
+    }
 }
 
 
@@ -4066,6 +4084,8 @@ lower_omp_for (tree *stmt_p, omp_context
   /* Once lowered, extract the bounds and clauses.  */
   extract_omp_for_data (stmt, &fd);
 
+  lower_omp_for_lastprivate (&fd, body_p, &dlist, ctx);
+
   append_to_statement_list (stmt, body_p);
 
   append_to_statement_list (OMP_FOR_BODY (stmt), body_p);
@@ -4074,7 +4094,6 @@ lower_omp_for (tree *stmt_p, omp_context
   append_to_statement_list (t, body_p);
 
   /* After the loop, add exit clauses.  */
-  lower_omp_for_lastprivate (&fd, &dlist, ctx);
   lower_reduction_clauses (OMP_FOR_CLAUSES (stmt), body_p, ctx);
   append_to_statement_list (dlist, body_p);
 
--- gcc/testsuite/gcc.dg/gomp/pr30421.c.jj	2007-01-18 19:23:24.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr30421.c	2007-01-18 19:24:39.000000000 +0100
@@ -0,0 +1,39 @@
+/* PR middle-end/30421 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -Wall" } */
+
+int
+foo ()
+{
+  int a = 0, i;
+
+#pragma omp parallel for firstprivate(a) lastprivate(a)
+  for (i = 0; i < 10; i++)
+    a += i;
+
+  return a;
+}
+
+int
+bar ()
+{
+  int a = 0, i;
+
+#pragma omp parallel for firstprivate(a) lastprivate(a) schedule(static, 2)
+  for (i = 0; i < 10; i++)
+    a += i;
+
+  return a;
+}
+
+int
+baz ()
+{
+  int a = 0, i;
+
+#pragma omp parallel for firstprivate(a) lastprivate(a) schedule(dynamic)
+  for (i = 0; i < 10; i++)
+    a += i;
+
+  return a;
+}

gcc41-pr30494.patch:
 gcc/gimplify.c                        |    7 ++-
 gcc/testsuite/g++.dg/gomp/pr30494.C   |   30 +++++++++++++++
 gcc/testsuite/gcc.dg/gomp/pr30494.c   |   30 +++++++++++++++
 libgomp/testsuite/libgomp.c/pr30494.c |   64 ++++++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+), 2 deletions(-)

--- NEW FILE gcc41-pr30494.patch ---
2007-01-23  Jakub Jelinek  <jakub at redhat.com>

	PR middle-end/30494
	* gimplify.c (omp_add_variable): Don't call omp_notice_variable
	on TYPE_SIZE_UNIT for GOVD_LOCAL VLAs.

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

	* testsuite/libgomp.c/pr30494.c: New test.

--- gcc/gimplify.c.jj	2007-01-17 16:10:16.000000000 +0100
+++ gcc/gimplify.c	2007-01-23 13:57:46.000000000 +0100
@@ -4505,8 +4505,11 @@ omp_add_variable (struct gimplify_omp_ct
       /* We're going to make use of the TYPE_SIZE_UNIT at least in the 
 	 alloca statement we generate for the variable, so make sure it
 	 is available.  This isn't automatically needed for the SHARED
-	 case, since we won't be allocating local storage then.  */
-      else
+	 case, since we won't be allocating local storage then.
+	 For local variables TYPE_SIZE_UNIT might not be gimplified yet,
+	 in this case omp_notice_variable will be called later
+	 on when it is gimplified.  */
+      else if (! (flags & GOVD_LOCAL))
 	omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
     }
   else if (lang_hooks.decls.omp_privatize_by_reference (decl))
--- libgomp/testsuite/libgomp.c/pr30494.c.jj	2007-01-23 13:48:05.000000000 +0100
+++ libgomp/testsuite/libgomp.c/pr30494.c	2007-01-23 13:54:30.000000000 +0100
@@ -0,0 +1,64 @@
+/* PR middle-end/30494 */
+/* { dg-do run } */
+
+#include <omp.h>
+
+int errors;
+
+int
+check (int m, int i, int *v, int *w)
+{
+  int j;
+  int n = omp_get_thread_num ();
+  for (j = 0; j < m; j++)
+    if (v[j] != j + n)
+      #pragma omp atomic
+	errors += 1;
+  for (j = 0; j < m * 3 + i; j++)
+    if (w[j] != j + 10 + n)
+      #pragma omp atomic
+	errors += 1;
+}
+
+int
+foo (int n, int m)
+{
+  int i;
+#pragma omp for
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i], j;
+      for (j = 0; j < n; j++)
+	v[j] = j + omp_get_thread_num ();
+      for (j = 0; j < n * 3 + i; j++)
+	w[j] = j + 10 + omp_get_thread_num ();
+      check (m, i, v, w);
+    }
+  return 0;
+}
+
+int
+bar (int n, int m)
+{
+  int i;
+#pragma omp parallel for num_threads (4)
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i], j;
+      for (j = 0; j < n; j++)
+	v[j] = j + omp_get_thread_num ();
+      for (j = 0; j < n * 3 + i; j++)
+	w[j] = j + 10 + omp_get_thread_num ();
+      check (m, i, v, w);
+    }
+  return 0;
+}
+
+int
+main (void)
+{
+#pragma omp parallel num_threads (3)
+  foo (128, 128);
+  bar (256, 256);
+  return 0;
+}
--- gcc/testsuite/gcc.dg/gomp/pr30494.c.jj	2007-01-23 13:46:54.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr30494.c	2007-01-23 13:46:25.000000000 +0100
@@ -0,0 +1,30 @@
+/* PR middle-end/30494 */
+/* { dg-do compile } */
+
+int
+foo (int n)
+{
+  int i;
+#pragma omp for
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i];
+      v[0] = 1;
+      w[0] = 2;
+    }
+  return 0;
+}
+
+int
+bar (int n)
+{
+  int i;
+#pragma parallel omp for
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i];
+      v[0] = 1;
+      w[0] = 2;
+    }
+  return 0;
+}
--- gcc/testsuite/g++.dg/gomp/pr30494.C.jj	2007-01-23 13:46:54.000000000 +0100
+++ gcc/testsuite/g++.dg/gomp/pr30494.C	2007-01-23 13:47:26.000000000 +0100
@@ -0,0 +1,30 @@
+// PR middle-end/30494
+// { dg-do compile }
+
+int
+foo (int n)
+{
+  int i;
+#pragma omp for
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i];
+      v[0] = 1;
+      w[0] = 2;
+    }
+  return 0;
+}
+
+int
+bar (int n)
+{
+  int i;
+#pragma parallel omp for
+  for (i = 0; i < 6; i++)
+    {
+      int v[n], w[n * 3 + i];
+      v[0] = 1;
+      w[0] = 2;
+    }
+  return 0;
+}


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/.cvsignore,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -r1.192 -r1.193
--- .cvsignore	5 Jan 2007 23:27:48 -0000	1.192
+++ .cvsignore	23 Jan 2007 22:13:04 -0000	1.193
@@ -1 +1 @@
-gcc-4.1.1-20070105.tar.bz2
+gcc-4.1.1-20070123.tar.bz2


Index: gcc41.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc41.spec,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- gcc41.spec	8 Jan 2007 23:49:58 -0000	1.139
+++ gcc41.spec	23 Jan 2007 22:13:04 -0000	1.140
@@ -1,6 +1,6 @@
-%define DATE 20070105
+%define DATE 20070123
 %define gcc_version 4.1.1
-%define gcc_release 53
+%define gcc_release 54
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
 %define include_gappletviewer 1
@@ -143,8 +143,9 @@
 Patch34: gcc41-pr30110.patch
 Patch35: gcc41-pr30143.patch
 Patch36: gcc41-pr30045.patch
-Patch37: gcc41-pr25514.patch
-Patch38: gcc41-libgomp-scanrtl.patch
+Patch37: gcc41-pr27416.patch
+Patch38: gcc41-pr30421.patch
+Patch39: gcc41-pr30494.patch
 %define _gnu %{nil}
 %ifarch sparc
 %define gcc_target_platform sparc64-%{_vendor}-%{_target_os}
@@ -456,8 +457,9 @@
 %patch34 -p0 -b .pr30110~
 %patch35 -p0 -b .pr30143~
 %patch36 -p0 -b .pr30045~
-%patch37 -p0 -b .pr25514~
-%patch38 -p0 -b .libgomp-scanrtl~
+%patch37 -p0 -b .pr27416~
+%patch38 -p0 -b .pr30421~
+%patch39 -p0 -b .pr30494~
 
 sed -i -e 's/4\.1\.2/4.1.1/' gcc/BASE-VER gcc/version.c
 sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@@ -1529,6 +1531,12 @@
 %doc rpm.doc/changelogs/libmudflap/ChangeLog*
 
 %changelog
+* Tue Jan 23 2007 Jakub Jelinek <jakub at redhat.com> 4.1.1-54
+- update from gcc-4_1-branch (-r120507:121069)
+  - PRs c++/28999, libgfortran/30435, objc/30479, rtl-optimization/29329,
+	target/30173, testsuite/12325
+- OpenMP fixes (PRs middle-end/27416, middle-end/30421, middle-end/30494)
+
 * Tue Jan  9 2007 Jakub Jelinek <jakub at redhat.com> 4.1.1-53
 - fix libgomp testsuite driver (Ulrich Weigand)
 - combiner fixes (Richard Sandiford, PR rtl-optimization/25514,


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/sources,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- sources	5 Jan 2007 23:27:48 -0000	1.194
+++ sources	23 Jan 2007 22:13:04 -0000	1.195
@@ -1 +1 @@
-4b9c1eb1d83c309010044b827b8c3e45  gcc-4.1.1-20070105.tar.bz2
+408aa3953830b61f30432831a5195db5  gcc-4.1.1-20070123.tar.bz2


--- gcc41-libgomp-scanrtl.patch DELETED ---


--- gcc41-pr25514.patch DELETED ---




More information about the fedora-cvs-commits mailing list