Commit 8569b2d0 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 53451050
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.
......
......@@ -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);
}
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;
......
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.
......
// 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" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment