diff options
author | Richard Biener <rguenth@gcc.gnu.org> | 2011-04-26 10:12:34 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-04-26 10:12:34 +0000 |
commit | e73a83fc7c03a209603e2607ec3be65adb197fa9 (patch) | |
tree | 96edb3341f7f619101c03cd207ab4d1b77b6a5c2 | |
parent | 961562d8d8720d823f3904050c16a2c65c9a5599 (diff) | |
download | gcc-e73a83fc7c03a209603e2607ec3be65adb197fa9.zip gcc-e73a83fc7c03a209603e2607ec3be65adb197fa9.tar.gz gcc-e73a83fc7c03a209603e2607ec3be65adb197fa9.tar.bz2 |
c-typeck.c (build_unary_op): Do not expand array-refs via pointer arithmetic.
2011-04-26 Richard Guenther <rguenther@suse.de>
* c-typeck.c (build_unary_op): Do not expand array-refs via
pointer arithmetic. Only adjust qualifiers for function types.
From-SVN: r172958
-rw-r--r-- | gcc/c-typeck.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index d8609d2..3849352 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3737,12 +3737,6 @@ build_unary_op (location_t location, tree op0 = TREE_OPERAND (arg, 0); if (!c_mark_addressable (op0)) return error_mark_node; - return build_binary_op (location, PLUS_EXPR, - (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE - ? array_to_pointer_conversion (location, - op0) - : op0), - TREE_OPERAND (arg, 1), 1); } /* Anything not already handled and not a true memory reference @@ -3769,10 +3763,11 @@ build_unary_op (location_t location, argtype = TREE_TYPE (arg); /* If the lvalue is const or volatile, merge that into the type - to which the address will point. This should only be needed + to which the address will point. This is only needed for function types. */ if ((DECL_P (arg) || REFERENCE_CLASS_P (arg)) - && (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))) + && (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg)) + && TREE_CODE (argtype) == FUNCTION_TYPE) { int orig_quals = TYPE_QUALS (strip_array_types (argtype)); int quals = orig_quals; @@ -3782,9 +3777,6 @@ build_unary_op (location_t location, if (TREE_THIS_VOLATILE (arg)) quals |= TYPE_QUAL_VOLATILE; - gcc_assert (quals == orig_quals - || TREE_CODE (argtype) == FUNCTION_TYPE); - argtype = c_build_qualified_type (argtype, quals); } |