diff options
author | Mike Stump <mikestump@comcast.net> | 2013-05-23 21:57:39 +0000 |
---|---|---|
committer | Mike Stump <mrs@gcc.gnu.org> | 2013-05-23 21:57:39 +0000 |
commit | cd192ccc8ae118f2b9c126de0e1f15eee33a4709 (patch) | |
tree | 1d1f57b27da49bc3ef58b0b8a395c9eaa62f039f /gcc/c | |
parent | 39bde5eae367fc1e57d277ea4496c485a3b9c09c (diff) | |
download | gcc-cd192ccc8ae118f2b9c126de0e1f15eee33a4709.zip gcc-cd192ccc8ae118f2b9c126de0e1f15eee33a4709.tar.gz gcc-cd192ccc8ae118f2b9c126de0e1f15eee33a4709.tar.bz2 |
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
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 23 |
2 files changed, 13 insertions, 15 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 819dfeb..e0fef1e1 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +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> * Make-lang.in (cc1$(exeext)): Use link mutex. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 5a29f7c..79386da 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -5245,11 +5245,9 @@ convert_for_assignment (location_t location, tree type, tree rhs, rhs = require_complete_type (rhs); if (rhs == error_mark_node) return error_mark_node; - /* A type converts to a reference to it. - This code doesn't fully support references, it's just for the - special case of va_start and va_copy. */ - if (codel == REFERENCE_TYPE - && comptypes (TREE_TYPE (type), TREE_TYPE (rhs)) == 1) + /* A non-reference type can convert to a reference. This handles + va_start, va_copy and possibly port built-ins. */ + if (codel == REFERENCE_TYPE && coder != REFERENCE_TYPE) { if (!lvalue_p (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); SET_EXPR_LOCATION (rhs, location); - /* We already know that these two types are compatible, but they - may not be exactly identical. In fact, `TREE_TYPE (type)' is - likely to be __builtin_va_list and `TREE_TYPE (rhs)' is - likely to be va_list, a typedef to __builtin_va_list, which - is different enough that it will cause problems later. */ - 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 = convert_for_assignment (location, build_pointer_type (TREE_TYPE (type)), + rhs, origtype, errtype, null_pointer_constant, + fundecl, function, parmnum); + if (rhs == error_mark_node) + return error_mark_node; rhs = build1 (NOP_EXPR, type, rhs); SET_EXPR_LOCATION (rhs, location); |