From 13eb1f7f0de383603d383c0644873ac8cb1afc62 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 28 Mar 2000 17:01:49 +0000 Subject: [PATCH] expr.c (store_constructor): SIZE now signed. * expr.c (store_constructor): SIZE now signed. For EXPR_SIZE, don't evaluate size; just needed if constant. * fold-const.c (fold): Fix a number of cases when folded tree is wrong type. * function.c (flush_addressof): Reenable. * tree.h (flush_addressof): Likewise. * toplev.c (independent_decode_option): Look at strings_processed. * config/alpha/alpha.h (MINIMUM_ATOMIC_ALIGNMENT): Cast to unsigned. From-SVN: r32783 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/alpha/alpha.h | 2 +- gcc/cp/decl2.c | 1 - gcc/expr.c | 10 +++++----- gcc/fold-const.c | 36 +++++++++++++++++------------------- gcc/function.c | 2 -- gcc/toplev.c | 24 ++++++++++++++---------- gcc/toplev.h | 2 +- gcc/tree.h | 1 + 9 files changed, 50 insertions(+), 39 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e69124bfcd7..fb06be1bcdd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +Tue Mar 28 11:55:48 2000 Richard Kenner + + * expr.c (store_constructor): SIZE now signed. + For EXPR_SIZE, don't evaluate size; just needed if constant. + * fold-const.c (fold): Fix a number of cases when folded tree is + wrong type. + * function.c (flush_addressof): Reenable. + * tree.h (flush_addressof): Likewise. + * toplev.c (independent_decode_option): Look at strings_processed. + * config/alpha/alpha.h (MINIMUM_ATOMIC_ALIGNMENT): Cast to unsigned. + Tue Mar 28 08:29:46 2000 Jan Hubicka * regmove.c (struct csa_memlist): Make mem field rtx *. diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 4fadf8e55e5..452899d4ed9 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -519,7 +519,7 @@ extern const char *alpha_mlat_string; /* For -mmemory-latency= */ /* For atomic access to objects, must have at least 32-bit alignment unless the machine has byte operations. */ -#define MINIMUM_ATOMIC_ALIGNMENT (TARGET_BWX ? 8 : 32) +#define MINIMUM_ATOMIC_ALIGNMENT ((unsigned int) (TARGET_BWX ? 8 : 32)) /* Align all constants and variables to at least a word boundary so we can pick up pieces of them faster. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5c1f7f8bb30..37a352ed385 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -572,7 +572,6 @@ lang_decode_option (argc, argv) #endif ; char **argv; - { int strings_processed; char *p = argv[0]; diff --git a/gcc/expr.c b/gcc/expr.c index fc390689727..447382b96d5 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -147,7 +147,7 @@ static void store_constructor_field PARAMS ((rtx, unsigned HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode, tree, tree, unsigned int, int)); static void store_constructor PARAMS ((tree, rtx, unsigned int, int, - unsigned HOST_WIDE_INT)); + HOST_WIDE_INT)); static rtx store_field PARAMS ((rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode, tree, enum machine_mode, int, @@ -4121,11 +4121,11 @@ store_constructor (exp, target, align, cleared, size) rtx target; unsigned int align; int cleared; - unsigned HOST_WIDE_INT size; + HOST_WIDE_INT size; { tree type = TREE_TYPE (exp); #ifdef WORD_REGISTER_OPERATIONS - rtx exp_size = expr_size (exp); + HOST_WIDE_INT exp_size = int_size_in_bytes (type); #endif /* We know our target cannot conflict, since safe_from_p has been called. */ @@ -4285,8 +4285,8 @@ store_constructor (exp, target, align, cleared, size) && bitpos % BITS_PER_WORD == 0 && GET_MODE_CLASS (mode) == MODE_INT && TREE_CODE (value) == INTEGER_CST - && GET_CODE (exp_size) == CONST_INT - && bitpos + BITS_PER_WORD <= INTVAL (exp_size) * BITS_PER_UNIT) + && exp_size >= 0 + && bitpos + BITS_PER_WORD <= exp_size * BITS_PER_UNIT) { tree type = TREE_TYPE (value); if (TYPE_PRECISION (type) < BITS_PER_WORD) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b32f65a5948..19b2f703201 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4734,10 +4734,8 @@ fold (expr) STRIP_SIGN_NOPS (op); } else - { - /* Strip any conversions that don't change the mode. */ - STRIP_NOPS (op); - } + /* Strip any conversions that don't change the mode. */ + STRIP_NOPS (op); if (TREE_CODE (op) == COMPLEX_CST) subop = TREE_REALPART (op); @@ -5226,7 +5224,7 @@ fold (expr) case CONJ_EXPR: if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE) - return arg0; + return convert (type, arg0); else if (TREE_CODE (arg0) == COMPLEX_EXPR) return build (COMPLEX_EXPR, type, TREE_OPERAND (arg0, 0), @@ -5881,7 +5879,7 @@ fold (expr) case MIN_EXPR: if (operand_equal_p (arg0, arg1, 0)) - return arg0; + return omit_one_operand (type, arg0, arg1); if (INTEGRAL_TYPE_P (type) && operand_equal_p (arg1, TYPE_MIN_VALUE (type), 1)) return omit_one_operand (type, arg1, arg0); @@ -5889,7 +5887,7 @@ fold (expr) case MAX_EXPR: if (operand_equal_p (arg0, arg1, 0)) - return arg0; + return omit_one_operand (type, arg0, arg1); if (INTEGRAL_TYPE_P (type) && TYPE_MAX_VALUE (type) && operand_equal_p (arg1, TYPE_MAX_VALUE (type), 1)) @@ -5913,13 +5911,13 @@ fold (expr) ("true" is a fixed value perhaps depending on the language.) */ /* If first arg is constant zero, return it. */ if (integer_zerop (arg0)) - return arg0; + return convert (type, arg0); case TRUTH_AND_EXPR: /* If either arg is constant true, drop it. */ if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0)) - return non_lvalue (arg1); + return non_lvalue (convert (type, arg1)); if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1)) - return non_lvalue (arg0); + return non_lvalue (convert (type, arg0)); /* If second arg is constant zero, result is zero, but first arg must be evaluated. */ if (integer_zerop (arg1)) @@ -5999,13 +5997,13 @@ fold (expr) ("true" is a fixed value perhaps depending on the language.) */ /* If first arg is constant true, return it. */ if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0)) - return arg0; + return convert (type, arg0); case TRUTH_OR_EXPR: /* If either arg is constant zero, drop it. */ if (TREE_CODE (arg0) == INTEGER_CST && integer_zerop (arg0)) - return non_lvalue (arg1); + return non_lvalue (convert (type, arg1)); if (TREE_CODE (arg1) == INTEGER_CST && integer_zerop (arg1)) - return non_lvalue (arg0); + return non_lvalue (convert (type, arg0)); /* If second arg is constant true, result is true, but we must evaluate first arg. */ if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1)) @@ -6019,14 +6017,14 @@ fold (expr) case TRUTH_XOR_EXPR: /* If either arg is constant zero, drop it. */ if (integer_zerop (arg0)) - return non_lvalue (arg1); + return non_lvalue (convert (type, arg1)); if (integer_zerop (arg1)) - return non_lvalue (arg0); + return non_lvalue (convert (type, arg0)); /* If either arg is constant true, this is a logical inversion. */ if (integer_onep (arg0)) - return non_lvalue (invert_truthvalue (arg1)); + return non_lvalue (convert (type, invert_truthvalue (arg1))); if (integer_onep (arg1)) - return non_lvalue (invert_truthvalue (arg0)); + return non_lvalue (convert (type, invert_truthvalue (arg0))); return t; case EQ_EXPR: @@ -7022,8 +7020,8 @@ fold (expr) return t; /* Don't let (0, 0) be null pointer constant. */ if (integer_zerop (arg1)) - return build1 (NOP_EXPR, TREE_TYPE (arg1), arg1); - return arg1; + return build1 (NOP_EXPR, type, arg1); + return convert (type, arg1); case COMPLEX_EXPR: if (wins) diff --git a/gcc/function.c b/gcc/function.c index 5bebaa9a031..2de8ec105da 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2803,7 +2803,6 @@ gen_mem_addressof (reg, decl) /* If DECL has an RTL that is an ADDRESSOF rtx, put it into the stack. */ -#if 0 void flush_addressof (decl) tree decl; @@ -2815,7 +2814,6 @@ flush_addressof (decl) && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 0)) == REG) put_addressof_into_stack (XEXP (DECL_RTL (decl), 0), 0); } -#endif /* Force the register pointed to by R, an ADDRESSOF rtx, into the stack. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index bf6dce21277..028aad89d80 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -170,7 +170,8 @@ static void decode_d_option PARAMS ((const char *)); static int decode_f_option PARAMS ((const char *)); static int decode_W_option PARAMS ((const char *)); static int decode_g_option PARAMS ((const char *)); -static unsigned independent_decode_option PARAMS ((int, char **, unsigned)); +static unsigned int independent_decode_option PARAMS ((int, char **, + unsigned int)); static void print_version PARAMS ((FILE *, const char *)); static int print_single_switch PARAMS ((FILE *, int, int, const char *, @@ -4434,13 +4435,13 @@ ignoring option `%s' due to invalid debug level specification", number of strings that have already been decoded in a language specific fashion before this function was invoked. */ -static unsigned +static unsigned int independent_decode_option (argc, argv, strings_processed) int argc; - char ** argv; - unsigned strings_processed ATTRIBUTE_UNUSED; + char **argv; + unsigned int strings_processed; { - char * arg = argv[0]; + char *arg = argv[0]; if (arg[0] != '-' || arg[1] == 0) { @@ -4463,7 +4464,7 @@ independent_decode_option (argc, argv, strings_processed) if (* arg == 'Y') arg ++; - switch (* arg) + switch (*arg) { default: return 0; @@ -4480,7 +4481,10 @@ independent_decode_option (argc, argv, strings_processed) return decode_f_option (arg + 1); case 'g': - return decode_g_option (arg + 1); + if (strings_processed == 0) + return decode_g_option (arg + 1); + else + return strings_processed; case 'd': if (!strcmp (arg, "dumpbase")) @@ -4777,8 +4781,8 @@ main (argc, argv) /* Perform normal command line switch decoding. */ for (i = 1; i < argc;) { - unsigned lang_processed; - unsigned indep_processed; + unsigned int lang_processed; + unsigned int indep_processed; /* Give the language a chance to decode the option for itself. */ lang_processed = lang_decode_option (argc - i, argv + i); @@ -4786,7 +4790,7 @@ main (argc, argv) /* Now see if the option also has a language independent meaning. Some options are both language specific and language independent, eg --help. It is possible that there might be options that should - only be decoded in a language independent way if the were not + only be decoded in a language independent way if they were not decoded in a langauge specific way, which is why 'lang_processed' is passed in. */ indep_processed = independent_decode_option (argc - i, argv + i, diff --git a/gcc/toplev.h b/gcc/toplev.h index 49990a8597b..5779ff994e3 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -136,5 +136,5 @@ extern int sorrycount; extern const char *progname; -extern void set_fatal_function PARAMS ((void (*)(const char *, va_list))); +extern void set_fatal_function PARAMS ((void (*) (const char *, va_list))); #endif /* __GCC_TOPLEV_H */ diff --git a/gcc/tree.h b/gcc/tree.h index 6f78cd6a12f..bc1e01d2510 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2490,6 +2490,7 @@ extern void init_function_for_compilation PARAMS ((void)); extern void init_function_start PARAMS ((tree, char *, int)); extern void assign_parms PARAMS ((tree)); extern void put_var_into_stack PARAMS ((tree)); +extern void flush_addressof PARAMS ((tree)); extern void uninitialized_vars_warning PARAMS ((tree)); extern void setjmp_args_warning PARAMS ((void)); extern void mark_all_temps_used PARAMS ((void)); -- 2.30.2