From a7d53fcee191e917ea946c9cbfd297756e12c64f Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Fri, 10 Jul 1992 01:49:46 +0000 Subject: [PATCH] (default_conversion): Use STRIP_TYPE_NOPS. (build_binary_op, build_function_call): Likewise. From-SVN: r1548 --- gcc/c-typeck.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2a8a5c17c71..d3da8d0e57a 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. */ -- 2.43.5