Commit 6415bd5d by Jason Merrill Committed by Jason Merrill

re PR c++/57926 (Atomic functions broken with C++ but not C?)

	PR c++/57926
	* c-common.c (sync_resolve_size, get_atomic_generic_size): Call
	default_conversion for an array argument.

From-SVN: r209316
parent 63620197
2014-04-11 Jason Merrill <jason@redhat.com>
PR c++/57926
* c-common.c (sync_resolve_size, get_atomic_generic_size): Call
default_conversion for an array argument.
2014-04-08 Marek Polacek <polacek@redhat.com> 2014-04-08 Marek Polacek <polacek@redhat.com>
PR sanitizer/60745 PR sanitizer/60745
......
...@@ -10202,6 +10202,13 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params) ...@@ -10202,6 +10202,13 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params)
} }
type = TREE_TYPE ((*params)[0]); type = TREE_TYPE ((*params)[0]);
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* Force array-to-pointer decay for C++. */
gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type = TREE_TYPE ((*params)[0]);
}
if (TREE_CODE (type) != POINTER_TYPE) if (TREE_CODE (type) != POINTER_TYPE)
goto incompatible; goto incompatible;
...@@ -10353,6 +10360,13 @@ get_atomic_generic_size (location_t loc, tree function, ...@@ -10353,6 +10360,13 @@ get_atomic_generic_size (location_t loc, tree function,
/* Get type of first parameter, and determine its size. */ /* Get type of first parameter, and determine its size. */
type_0 = TREE_TYPE ((*params)[0]); type_0 = TREE_TYPE ((*params)[0]);
if (TREE_CODE (type_0) == ARRAY_TYPE)
{
/* Force array-to-pointer decay for C++. */
gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type_0 = TREE_TYPE ((*params)[0]);
}
if (TREE_CODE (type_0) != POINTER_TYPE || VOID_TYPE_P (TREE_TYPE (type_0))) if (TREE_CODE (type_0) != POINTER_TYPE || VOID_TYPE_P (TREE_TYPE (type_0)))
{ {
error_at (loc, "argument 1 of %qE must be a non-void pointer type", error_at (loc, "argument 1 of %qE must be a non-void pointer type",
......
// PR c++/57926
long Mutex[1];
int AcquireLogMutex(void)
{
return __atomic_exchange_n(Mutex, 1, __ATOMIC_SEQ_CST);
}
void ReleaseLogMutex(void)
{
long i = 0;
__atomic_store(Mutex, &i, __ATOMIC_SEQ_CST);
}
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