Commit cd192ccc by Mike Stump Committed by Mike Stump

c-typeck.c (convert_for_assignment): Handle references to memory spaces better.

	* c-typeck.c (convert_for_assignment): Handle references to memory
	spaces better.

From-SVN: r199270
parent 39bde5ea
2013-05-23 Mike Stump <mikestump@comcast.net>
* c-typeck.c (convert_for_assignment): Handle references to memory
spaces better.
2013-05-16 Jason Merrill <jason@redhat.com> 2013-05-16 Jason Merrill <jason@redhat.com>
* Make-lang.in (cc1$(exeext)): Use link mutex. * Make-lang.in (cc1$(exeext)): Use link mutex.
......
...@@ -5245,11 +5245,9 @@ convert_for_assignment (location_t location, tree type, tree rhs, ...@@ -5245,11 +5245,9 @@ convert_for_assignment (location_t location, tree type, tree rhs,
rhs = require_complete_type (rhs); rhs = require_complete_type (rhs);
if (rhs == error_mark_node) if (rhs == error_mark_node)
return error_mark_node; return error_mark_node;
/* A type converts to a reference to it. /* A non-reference type can convert to a reference. This handles
This code doesn't fully support references, it's just for the va_start, va_copy and possibly port built-ins. */
special case of va_start and va_copy. */ if (codel == REFERENCE_TYPE && coder != REFERENCE_TYPE)
if (codel == REFERENCE_TYPE
&& comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1)
{ {
if (!lvalue_p (rhs)) if (!lvalue_p (rhs))
{ {
...@@ -5261,16 +5259,11 @@ convert_for_assignment (location_t location, tree type, tree rhs, ...@@ -5261,16 +5259,11 @@ convert_for_assignment (location_t location, tree type, tree rhs,
rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs); rhs = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (rhs)), rhs);
SET_EXPR_LOCATION (rhs, location); SET_EXPR_LOCATION (rhs, location);
/* We already know that these two types are compatible, but they rhs = convert_for_assignment (location, build_pointer_type (TREE_TYPE (type)),
may not be exactly identical. In fact, `TREE_TYPE (type)' is rhs, origtype, errtype, null_pointer_constant,
likely to be __builtin_va_list and `TREE_TYPE (rhs)' is fundecl, function, parmnum);
likely to be va_list, a typedef to __builtin_va_list, which if (rhs == error_mark_node)
is different enough that it will cause problems later. */ return error_mark_node;
if (TREE_TYPE (TREE_TYPE (rhs)) != TREE_TYPE (type))
{
rhs = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), rhs);
SET_EXPR_LOCATION (rhs, location);
}
rhs = build1 (NOP_EXPR, type, rhs); rhs = build1 (NOP_EXPR, type, rhs);
SET_EXPR_LOCATION (rhs, location); SET_EXPR_LOCATION (rhs, location);
......
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