[C++ PATCH] Fix for-2.C OpenMP regression (PR c++/51496)
Jakub Jelinek
jakub@redhat.com
Mon Dec 12 17:11:00 GMT 2011
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.
--- 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);
}
Jakub
More information about the Gcc-patches
mailing list