re PR c++/37533 (ICE with parallel for loop)

PR c++/37533
	* semantics.c (finish_omp_for): If processing_template_decl, just build
	MODIFY_EXPR for init instead of calling cp_build_modify_expr.

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

From-SVN: r140613
This commit is contained in:
Jakub Jelinek 2008-09-23 20:57:18 +02:00 committed by Jakub Jelinek
parent 5345105058
commit 8569b2d0a9
4 changed files with 67 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2008-09-23 Jakub Jelinek <jakub@redhat.com>
PR c++/37533
* semantics.c (finish_omp_for): If processing_template_decl, just build
MODIFY_EXPR for init instead of calling cp_build_modify_expr.
2008-09-23 Aldy Hernandez <aldyh@redhat.com>
* typeck.c (build_array_ref): Pass location to cp_build_binary_op.

View File

@ -4291,8 +4291,12 @@ finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
}
if (!processing_template_decl)
init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error);
{
init = fold_build_cleanup_point_expr (TREE_TYPE (init), init);
init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error);
}
else
init = build2 (MODIFY_EXPR, void_type_node, decl, init);
if (cond && TREE_SIDE_EFFECTS (cond) && COMPARISON_CLASS_P (cond))
{
int n = TREE_SIDE_EFFECTS (TREE_OPERAND (cond, 1)) != 0;

View File

@ -1,3 +1,8 @@
2008-09-23 Jakub Jelinek <jakub@redhat.com>
PR c++/37533
* g++.dg/gomp/pr37533.C: New test.
2008-09-23 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/vect/slp-widen-mult-s16.c: Fix typo.

View File

@ -0,0 +1,50 @@
// PR c++/37533
// { dg-do compile }
// { dg-options "-fopenmp" }
template<int>
void
f1 ()
{
#pragma omp parallel for
for (int i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
;
}
template<int>
void
f2 ()
{
int i;
#pragma omp parallel for
for (i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
;
}
template<typename T>
void
f3 ()
{
#pragma omp parallel for
for (T i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
;
}
template<typename T>
void
f4 ()
{
T i;
#pragma omp parallel for
for (i = ""; i < 4; ++i) // { dg-error "invalid conversion from" }
;
}
void
bar ()
{
f1<0> (); // { dg-message "instantiated from here" }
f2<1> (); // { dg-message "instantiated from here" }
f3<int> (); // { dg-message "instantiated from here" }
f4<int> (); // { dg-message "instantiated from here" }
}