diff mbox

[C++] Fix for-2.C OpenMP regression (PR c++/51496)

Message ID 20111212170518.GT1957@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 12, 2011, 5:05 p.m. UTC
Hi!

On
extern void baz (int);
template <long N>
void
f7 (int i, int x, int y)
{
#pragma omp parallel for
  for (i = x - 10; i <= y + 10; i += N)
    baz (i);
}
part of libgomp.c++/for-2.C testcase we now ICE, because the increment
expression contains IMPLICIT_CONV_EXPR.  Fixed by also using
cp_parser_omp_for_incr when processing_template_decl and, while
decl is NULL, real_decl is non-NULL (if decl is non-NULL, real_decl
is equal to that).

Bootstrapped/regtested on x86_64-linux and i686-linux, does this look ok
to you?

2011-12-12  Jakub Jelinek  <jakub@redhat.com>

	PR c++/51496
	* parser.c (cp_parser_omp_for_loop): When determining whether
	to use cp_parser_omp_for_incr or cp_parser_expression and when
	calling cp_parser_omp_for_incr, use real_decl instead of decl.


	Jakub

Comments

Jason Merrill Dec. 12, 2011, 5:50 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

--- gcc/cp/parser.c.jj	2011-12-11 22:02:36.000000000 +0100
+++ gcc/cp/parser.c	2011-12-12 13:11:27.338530238 +0100
@@ -26304,11 +26304,11 @@  cp_parser_omp_for_loop (cp_parser *parse
 	{
 	  /* If decl is an iterator, preserve the operator on decl
 	     until finish_omp_for.  */
-	  if (decl
+	  if (real_decl
 	      && ((processing_template_decl
-		   && !POINTER_TYPE_P (TREE_TYPE (decl)))
-		  || CLASS_TYPE_P (TREE_TYPE (decl))))
-	    incr = cp_parser_omp_for_incr (parser, decl);
+		   && !POINTER_TYPE_P (TREE_TYPE (real_decl)))
+		  || CLASS_TYPE_P (TREE_TYPE (real_decl))))
+	    incr = cp_parser_omp_for_incr (parser, real_decl);
 	  else
 	    incr = cp_parser_expression (parser, false, NULL);
 	}