rpms/gcc/devel gcc41-pr26559.patch,NONE,1.1 gcc41.spec,1.75,1.76
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Tue Jun 20 09:11:30 UTC 2006
Author: jakub
Update of /cvs/dist/rpms/gcc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv5265
Modified Files:
gcc41.spec
Added Files:
gcc41-pr26559.patch
Log Message:
4.1.1-5
gcc41-pr26559.patch:
0 files changed
--- NEW FILE gcc41-pr26559.patch ---
2006-06-14 Mark Mitchell <mark at codesourcery.com>
PR c++/26559
* c-common.h (c_finish_omp_atomic): Adjust declaration.
* c-omp.c (c_finish_omp_atomic): Return the expression to perform,
rather than calling add_stmt on it.
* c-parser.c (c_parser_omp_atomic): Adjust accordingly.
* pt.c (tsubst_expr): Use finish_omp_atomic.
* semantics.c (finish_omp_atomic): Rework to use standard
paradigms for handling non-dependent expressions.
* g++.dg/gomp/tpl-atomic-2.C: Remove XFAIL.
--- gcc/c-omp.c (revision 114664)
+++ gcc/c-omp.c (revision 114665)
@@ -82,15 +82,18 @@ c_finish_omp_barrier (void)
/* Complete a #pragma omp atomic construct. The expression to be
- implemented atomically is LHS code= RHS. */
+ implemented atomically is LHS code= RHS. The value returned is
+ either error_mark_node (if the construct was erroneous) or an
+ OMP_ATOMIC node which should be added to the current statement tree
+ with add_stmt. */
-void
+tree
c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
{
tree x, type, addr;
if (lhs == error_mark_node || rhs == error_mark_node)
- return;
+ return error_mark_node;
/* ??? According to one reading of the OpenMP spec, complex type are
supported, but there are no atomic stores for any architecture.
@@ -102,7 +105,7 @@ c_finish_omp_atomic (enum tree_code code
&& !SCALAR_FLOAT_TYPE_P (type))
{
error ("invalid expression type for %<#pragma omp atomic%>");
- return;
+ return error_mark_node;
}
/* ??? Validate that rhs does not overlap lhs. */
@@ -111,7 +114,7 @@ c_finish_omp_atomic (enum tree_code code
via indirection. */
addr = build_unary_op (ADDR_EXPR, lhs, 0);
if (addr == error_mark_node)
- return;
+ return error_mark_node;
addr = save_expr (addr);
lhs = build_indirect_ref (addr, NULL);
@@ -120,12 +123,12 @@ c_finish_omp_atomic (enum tree_code code
to do this, and then take it apart again. */
x = build_modify_expr (lhs, code, rhs);
if (x == error_mark_node)
- return;
+ return error_mark_node;
gcc_assert (TREE_CODE (x) == MODIFY_EXPR);
rhs = TREE_OPERAND (x, 1);
/* Punt the actual generation of atomic operations to common code. */
- add_stmt (build2 (OMP_ATOMIC, void_type_node, addr, rhs));
+ return build2 (OMP_ATOMIC, void_type_node, addr, rhs);
}
--- gcc/c-common.h (revision 114664)
+++ gcc/c-common.h (revision 114665)
@@ -948,7 +948,7 @@ extern tree c_finish_omp_master (tree);
extern tree c_finish_omp_critical (tree, tree);
extern tree c_finish_omp_ordered (tree);
extern void c_finish_omp_barrier (void);
-extern void c_finish_omp_atomic (enum tree_code, tree, tree);
+extern tree c_finish_omp_atomic (enum tree_code, tree, tree);
extern void c_finish_omp_flush (void);
extern tree c_finish_omp_for (location_t, tree, tree, tree, tree, tree, tree);
extern void c_split_parallel_clauses (tree, tree *, tree *);
--- gcc/c-parser.c (revision 114664)
+++ gcc/c-parser.c (revision 114665)
@@ -7214,6 +7214,7 @@ static void
c_parser_omp_atomic (c_parser *parser)
{
tree lhs, rhs;
+ tree stmt;
enum tree_code code;
c_parser_skip_to_pragma_eol (parser);
@@ -7280,7 +7281,9 @@ c_parser_omp_atomic (c_parser *parser)
rhs = c_parser_expression (parser).value;
break;
}
- c_finish_omp_atomic (code, lhs, rhs);
+ stmt = c_finish_omp_atomic (code, lhs, rhs);
+ if (stmt != error_mark_node)
+ add_stmt (stmt);
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
--- gcc/cp/pt.c (revision 114664)
+++ gcc/cp/pt.c (revision 114665)
@@ -8546,10 +8546,7 @@ tsubst_expr (tree t, tree args, tsubst_f
tree op0, op1;
op0 = tsubst_expr (TREE_OPERAND (t, 0), args, complain, in_decl);
op1 = tsubst_expr (TREE_OPERAND (t, 1), args, complain, in_decl);
- if (OMP_ATOMIC_DEPENDENT_P (t))
- c_finish_omp_atomic (OMP_ATOMIC_CODE (t), op0, op1);
- else
- add_stmt (build2 (OMP_ATOMIC, void_type_node, op0, op1));
+ finish_omp_atomic (OMP_ATOMIC_CODE (t), op0, op1);
}
break;
--- gcc/cp/semantics.c (revision 114670)
+++ gcc/cp/semantics.c (revision 114671)
@@ -3834,24 +3834,41 @@ finish_omp_for (location_t locus, tree d
void
finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
{
- /* If either of the operands are dependent, we can't do semantic
- processing yet. Stuff the values away for now. We cheat a bit
- 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. */
- /* ??? 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 orig_lhs;
+ tree orig_rhs;
+ bool dependent_p;
+ tree stmt;
+
+ orig_lhs = lhs;
+ orig_rhs = rhs;
+ dependent_p = false;
+ stmt = NULL_TREE;
+
+ /* Even in a template, we can detect invalid uses of the atomic
+ pragma if neither LHS nor RHS is type-dependent. */
+ if (processing_template_decl)
{
- tree stmt = build2 (OMP_ATOMIC, void_type_node, lhs, rhs);
+ dependent_p = (type_dependent_expression_p (lhs)
+ || type_dependent_expression_p (rhs));
+ if (!dependent_p)
+ {
+ lhs = build_non_dependent_expr (lhs);
+ rhs = build_non_dependent_expr (rhs);
+ }
+ }
+ if (!dependent_p)
+ {
+ stmt = c_finish_omp_atomic (code, lhs, rhs);
+ if (stmt == error_mark_node)
+ return;
+ }
+ if (processing_template_decl)
+ {
+ stmt = build2 (OMP_ATOMIC, void_type_node, orig_lhs, orig_rhs);
OMP_ATOMIC_DEPENDENT_P (stmt) = 1;
OMP_ATOMIC_CODE (stmt) = code;
- add_stmt (stmt);
}
- else
- c_finish_omp_atomic (code, lhs, rhs);
+ add_stmt (stmt);
}
void
--- gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C (revision 114664)
+++ gcc/testsuite/g++.dg/gomp/tpl-atomic-2.C (revision 114665)
@@ -17,11 +17,10 @@ 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" "" { xfail *-*-* } }
+ *f |= sizeof (T); // { dg-error "invalid|evaluation" }
}
// And the converse, no error here because we're never fed a T.
Index: gcc41.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc41.spec,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- gcc41.spec 19 Jun 2006 21:02:26 -0000 1.75
+++ gcc41.spec 20 Jun 2006 09:11:27 -0000 1.76
@@ -1,6 +1,6 @@
%define DATE 20060619
%define gcc_version 4.1.1
-%define gcc_release 4
+%define gcc_release 5
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%ifarch %{ix86} x86_64 ia64
@@ -125,6 +125,7 @@
Patch24: gcc41-pr26885.patch
Patch25: gcc41-libgomp-critical.patch
Patch26: gcc41-merge-all-constants.patch
+Patch27: gcc41-pr26559.patch
%define _gnu %{nil}
%ifarch sparc
%define gcc_target_platform sparc64-%{_vendor}-%{_target_os}
@@ -429,6 +430,7 @@
%patch24 -p0 -b .pr26885~
%patch25 -p0 -b .libgomp-critical~
%patch26 -p0 -b .merge-all-constants~
+%patch27 -p0 -b .pr26559~
sed -i -e 's/4\.1\.2/4.1.1/' gcc/BASE-VER gcc/version.c
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@@ -1470,6 +1472,9 @@
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
+* Tue Jun 20 2006 Jakub Jelinek <jakub at redhat.com> 4.1.1-5
+- fix C++ #pragma omp atomic (Mark Mitchell)
+
* Mon Jun 19 2006 Jakub Jelinek <jakub at redhat.com> 4.1.1-4
- update from gcc-4_1-branch (-r114555:114766)
- PRs bootstrap/22541, c++/21210, c++/26559, c++/27227, c++/27648,
More information about the fedora-cvs-commits
mailing list