This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp] fix tpl-atomic-1.C
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 19 Oct 2005 16:35:36 -0700
- Subject: [gomp] fix tpl-atomic-1.C
Sigh. Resolve an ICE in favour of delaying a diagnostic
to template instantiation time. Which in the case of the
other test, never happens.
r~
* semantics.c (finish_omp_atomic): Revert to uses_template_parms.
* g++.dg/gomp/tpl-atomic-2.C: XFAIL one test.
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.475.4.10
diff -u -p -d -r1.475.4.10 semantics.c
--- semantics.c 19 Oct 2005 10:12:16 -0000 1.475.4.10
+++ semantics.c 19 Oct 2005 23:30:58 -0000
@@ -3635,7 +3635,11 @@ finish_omp_atomic (enum tree_code code,
and use the same tree code for this, even though the operands
are of totally different form, thus we need to remember which
statements are which, thus the lang_flag bit. */
- if (type_dependent_expression_p (lhs) || type_dependent_expression_p (rhs))
+ /* ??? We ought to be using type_dependent_expression_p, but the
+ invocation of build_modify_expr in c_finish_omp_atomic can result
+ in the creation of CONVERT_EXPRs, which are not handled by
+ tsubst_copy_and_build. */
+ if (uses_template_parms (lhs) || uses_template_parms (rhs))
{
tree stmt = build2 (OMP_ATOMIC, void_type_node, lhs, rhs);
OMP_ATOMIC_DEPENDENT_P (stmt) = 1;
Index: g++.dg/gomp/tpl-atomic-2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/gomp/Attic/tpl-atomic-2.C,v
retrieving revision 1.1.2.1
diff -u -p -d -r1.1.2.1 tpl-atomic-2.C
--- g++.dg/gomp/tpl-atomic-2.C 19 Oct 2005 09:44:08 -0000 1.1.2.1
+++ g++.dg/gomp/tpl-atomic-2.C 19 Oct 2005 23:31:08 -0000
@@ -17,10 +17,11 @@ template<typename T> void f2(float *f)
}
// Here the rhs is dependent, but not type dependent.
+// ??? Fails. See the comment in finish_omp_atomic.
template<typename T> void f3(float *f)
{
#pragma omp atomic
- *f |= sizeof (T); // { dg-error "invalid|evaluation" }
+ *f |= sizeof (T); // { dg-error "invalid|evaluation" "" { xfail *-*-* } }
}
// And the converse, no error here because we're never fed a T.