aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-07-10 01:49:46 +0000
committerRichard Stallman <rms@gnu.org>1992-07-10 01:49:46 +0000
commita7d53fcee191e917ea946c9cbfd297756e12c64f (patch)
tree16d2ed4bc682b124d9b4f6df3c9309baaa5f0acd /gcc
parent0fafb45e4b8e5c4d102833d9fe39334cc35e43d7 (diff)
downloadgcc-a7d53fcee191e917ea946c9cbfd297756e12c64f.zip
gcc-a7d53fcee191e917ea946c9cbfd297756e12c64f.tar.gz
gcc-a7d53fcee191e917ea946c9cbfd297756e12c64f.tar.bz2
(default_conversion): Use STRIP_TYPE_NOPS.
(build_binary_op, build_function_call): Likewise. From-SVN: r1548
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 2a8a5c1..d3da8d0 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -889,8 +889,14 @@ default_conversion (exp)
type = TREE_TYPE (exp);
}
- /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_NOPS (exp);
+ /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as
+ an lvalue. */
+ /* Do not use STRIP_NOPS here! It will remove conversions from pointer
+ to integer and cause infinite recursion. */
+ while (TREE_CODE (exp) == NON_LVALUE_EXPR
+ || (TREE_CODE (exp) == NOP_EXPR
+ && TREE_TYPE (TREE_OPERAND (exp, 0)) == TREE_TYPE (exp)))
+ exp = TREE_OPERAND (exp, 0);
/* Normally convert enums to int,
but convert wide enums to something wider. */
@@ -1774,7 +1780,7 @@ build_function_call (function, params)
tree name = NULL_TREE;
/* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_NOPS (function);
+ STRIP_TYPE_NOPS (function);
/* Convert anything with function type to a pointer-to-function. */
if (TREE_CODE (function) == FUNCTION_DECL)
@@ -2226,8 +2232,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
code1 = TREE_CODE (type1);
/* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_NOPS (op0);
- STRIP_NOPS (op1);
+ STRIP_TYPE_NOPS (op0);
+ STRIP_TYPE_NOPS (op1);
/* If an error was already reported for one of the arguments,
avoid reporting another error. */