aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-03-20 15:23:50 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-03-20 15:23:50 +0000
commitf6d1c3a69b64edc2ff6d10d8ec89456552a5f3a8 (patch)
tree4b6f9cfd528a8733782d0ef9c585656d6f4190ce
parente498b9f1a0460c20a42d6835470de35d858379da (diff)
downloadgcc-f6d1c3a69b64edc2ff6d10d8ec89456552a5f3a8.zip
gcc-f6d1c3a69b64edc2ff6d10d8ec89456552a5f3a8.tar.gz
gcc-f6d1c3a69b64edc2ff6d10d8ec89456552a5f3a8.tar.bz2
c-common.c (handle_aligned_attribute, [...]): Do not strip NOPS from INTEGER_CSTs.
* c-common.c (handle_aligned_attribute, check_function_sentinel, get_nonnull_operand, handle_sentinel_attribute, check_function_arguments_recurse): Do not strip NOPS from INTEGER_CSTs. * c-decl.c (check_bitfield_type_and_width, build_enumerator): Likewise. * c-format.c (get_constant): Likewise. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (set_init_index): Likewise. (convert_arguments): Don't check for NOP_EXPR containing integer constant. From-SVN: r96760
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-common.c20
-rw-r--r--gcc/c-decl.c7
-rw-r--r--gcc/c-format.c9
-rw-r--r--gcc/c-parser.c1
-rw-r--r--gcc/c-typeck.c20
6 files changed, 17 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cc0a972..171eeef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2005-03-20 Joseph S. Myers <joseph@codesourcery.com>
+
+ * c-common.c (handle_aligned_attribute, check_function_sentinel,
+ get_nonnull_operand, handle_sentinel_attribute,
+ check_function_arguments_recurse): Do not strip NOPS from
+ INTEGER_CSTs.
+ * c-decl.c (check_bitfield_type_and_width, build_enumerator):
+ Likewise.
+ * c-format.c (get_constant): Likewise.
+ * c-parser.c (c_parser_postfix_expression): Likewise.
+ * c-typeck.c (set_init_index): Likewise.
+ (convert_arguments): Don't check for NOP_EXPR containing integer
+ constant.
+
2005-03-20 Kazu Hirata <kazu@cs.umass.edu>
* builtins.c (fold_fixed_mathfn, fold_builtin_trunc,
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 6517286..f8162fc 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4481,12 +4481,6 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
else if (TYPE_P (*node))
type = node, is_type = 1;
- /* Strip any NOPs of any kind. */
- while (TREE_CODE (align_expr) == NOP_EXPR
- || TREE_CODE (align_expr) == CONVERT_EXPR
- || TREE_CODE (align_expr) == NON_LVALUE_EXPR)
- align_expr = TREE_OPERAND (align_expr, 0);
-
if (TREE_CODE (align_expr) != INTEGER_CST)
{
error ("requested alignment is not a constant");
@@ -5119,7 +5113,6 @@ check_function_sentinel (tree attrs, tree params)
if (TREE_VALUE (attr))
{
tree p = TREE_VALUE (TREE_VALUE (attr));
- STRIP_NOPS (p);
pos = TREE_INT_CST_LOW (p);
}
@@ -5199,13 +5192,7 @@ check_nonnull_arg (void * ARG_UNUSED (ctx), tree param,
static bool
get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
{
- /* Strip any conversions from the arg number and verify they
- are constants. */
- while (TREE_CODE (arg_num_expr) == NOP_EXPR
- || TREE_CODE (arg_num_expr) == CONVERT_EXPR
- || TREE_CODE (arg_num_expr) == NON_LVALUE_EXPR)
- arg_num_expr = TREE_OPERAND (arg_num_expr, 0);
-
+ /* Verify the arg number is a constant. */
if (TREE_CODE (arg_num_expr) != INTEGER_CST
|| TREE_INT_CST_HIGH (arg_num_expr) != 0)
return false;
@@ -5324,7 +5311,6 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
{
tree position = TREE_VALUE (args);
- STRIP_NOPS (position);
if (TREE_CODE (position) != INTEGER_CST)
{
warning ("requested position is not an integer constant");
@@ -5402,10 +5388,6 @@ check_function_arguments_recurse (void (*callback)
/* Extract the argument number, which was previously checked
to be valid. */
format_num_expr = TREE_VALUE (TREE_VALUE (attrs));
- while (TREE_CODE (format_num_expr) == NOP_EXPR
- || TREE_CODE (format_num_expr) == CONVERT_EXPR
- || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR)
- format_num_expr = TREE_OPERAND (format_num_expr, 0);
gcc_assert (TREE_CODE (format_num_expr) == INTEGER_CST
&& !TREE_INT_CST_HIGH (format_num_expr));
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 42f6561..0b86086 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3637,9 +3637,6 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
unsigned HOST_WIDE_INT w;
const char *name = orig_name ? orig_name: _("<anonymous>");
- /* Necessary? */
- STRIP_NOPS (*width);
-
/* Detect and ignore out of range field width and process valid
field widths. */
if (!INTEGRAL_TYPE_P (TREE_TYPE (*width))
@@ -5624,10 +5621,6 @@ build_enumerator (tree name, tree value)
/* Validate and default VALUE. */
- /* Remove no-op casts from the value. */
- if (value)
- STRIP_TYPE_NOPS (value);
-
if (value != 0)
{
/* Don't issue more errors for error_mark_node (i.e. an
diff --git a/gcc/c-format.c b/gcc/c-format.c
index 914d6cc..a228b4b 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -147,17 +147,12 @@ check_format_string (tree argument, unsigned HOST_WIDE_INT format_num,
return true;
}
-/* Strip any conversions from the expression, verify it is a constant,
- and store its value. If validated_p is true, abort on errors.
+/* Verify EXPR is a constant, and store its value.
+ If validated_p is true, abort on errors.
Returns true on success, false otherwise. */
static bool
get_constant (tree expr, unsigned HOST_WIDE_INT *value, int validated_p)
{
- while (TREE_CODE (expr) == NOP_EXPR
- || TREE_CODE (expr) == CONVERT_EXPR
- || TREE_CODE (expr) == NON_LVALUE_EXPR)
- expr = TREE_OPERAND (expr, 0);
-
if (TREE_CODE (expr) != INTEGER_CST || TREE_INT_CST_HIGH (expr) != 0)
{
gcc_assert (!validated_p);
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index fa62475..99b6e09 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -5019,7 +5019,6 @@ c_parser_postfix_expression (c_parser *parser)
tree c;
c = fold (e1.value);
- STRIP_NOPS (c);
if (TREE_CODE (c) != INTEGER_CST)
error ("first argument to %<__builtin_choose_expr%> not"
" a constant");
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 6f2a6bc..3b35acf 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2234,11 +2234,6 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
/* Change in signedness doesn't matter
if a constant value is unaffected. */
;
- /* Likewise for a constant in a NOP_EXPR. */
- else if (TREE_CODE (val) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST
- && int_fits_type_p (TREE_OPERAND (val, 0), type))
- ;
/* If the value is extended from a narrower
unsigned type, it doesn't matter whether we
pass it as signed or unsigned; the value
@@ -5205,21 +5200,6 @@ set_init_index (tree first, tree last)
return;
}
- while ((TREE_CODE (first) == NOP_EXPR
- || TREE_CODE (first) == CONVERT_EXPR
- || TREE_CODE (first) == NON_LVALUE_EXPR)
- && (TYPE_MODE (TREE_TYPE (first))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0)))))
- first = TREE_OPERAND (first, 0);
-
- if (last)
- while ((TREE_CODE (last) == NOP_EXPR
- || TREE_CODE (last) == CONVERT_EXPR
- || TREE_CODE (last) == NON_LVALUE_EXPR)
- && (TYPE_MODE (TREE_TYPE (last))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0)))))
- last = TREE_OPERAND (last, 0);
-
if (TREE_CODE (first) != INTEGER_CST)
error_init ("nonconstant array index in initializer");
else if (last != 0 && TREE_CODE (last) != INTEGER_CST)