From: Michal Moskal Date: Fri, 23 Aug 2002 13:34:42 +0000 (+0000) Subject: - fixes issue with miscompilation with -march=i686, patch from H.J.Lu X-Git-Tag: STABLE~5 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=250aa0e0de03b1cb1c0774c1f934e7fa42ef4a2a;hp=f52cf35c9da2638d0748223a07fe7ce8f472b0d8;p=packages%2Fgcc.git - fixes issue with miscompilation with -march=i686, patch from H.J.Lu Changed files: gcc-march-i686-fix.patch -> 1.1 --- diff --git a/gcc-march-i686-fix.patch b/gcc-march-i686-fix.patch new file mode 100644 index 0000000..4aeeef0 --- /dev/null +++ b/gcc-march-i686-fix.patch @@ -0,0 +1,110 @@ +2002-08-17 H.J. Lu + + * calls.c (PUSH_ARGS_REVERSED): Define only if not defined. + * expr.c (PUSH_ARGS_REVERSED): Likewise. + +2002-07-26 H.J. Lu + + * config/i386/i386.h (PUSH_ARGS_REVERSED): Set to 1. + +--- gcc/calls.c.var Thu Apr 4 15:28:47 2002 ++++ gcc/calls.c Sat Aug 17 22:45:46 2002 +@@ -46,9 +46,11 @@ Software Foundation, 59 Temple Place - S + + #ifdef PUSH_ROUNDING + ++#ifndef PUSH_ARGS_REVERSED + #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD) + #define PUSH_ARGS_REVERSED PUSH_ARGS + #endif ++#endif + + #endif + +--- gcc/config/i386/i386.h.var Sun Jul 14 23:54:36 2002 ++++ gcc/config/i386/i386.h Sat Aug 17 19:03:21 2002 +@@ -1581,6 +1581,10 @@ enum reg_class + + #define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS) + ++/* We want the stack and args grow in opposite directions, even if ++ PUSH_ARGS is 0. */ ++#define PUSH_ARGS_REVERSED 1 ++ + /* Offset of first parameter from the argument pointer register value. */ + #define FIRST_PARM_OFFSET(FNDECL) 0 + +--- gcc/expr.c.var Mon May 6 22:43:11 2002 ++++ gcc/expr.c Sat Aug 17 22:52:27 2002 +@@ -54,9 +54,11 @@ Software Foundation, 59 Temple Place - S + + #ifdef PUSH_ROUNDING + ++#ifndef PUSH_ARGS_REVERSED + #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD) + #define PUSH_ARGS_REVERSED /* If it's last to first. */ + #endif ++#endif + + #endif + +2002-08-18 H.J. Lu + + * calls.c (store_one_arg): Remove ATTRIBUTE_UNUSED on + variable_size. Mark any slots used for the argument as in-use + only if we can't pass all arguments to a library call in + registers. + +--- gcc/calls.c.copy Sun Aug 18 07:35:11 2002 ++++ gcc/calls.c Sun Aug 18 08:27:29 2002 +@@ -4270,7 +4270,7 @@ store_one_arg (arg, argblock, flags, var + struct arg_data *arg; + rtx argblock; + int flags; +- int variable_size ATTRIBUTE_UNUSED; ++ int variable_size; + int reg_parm_stack_space; + { + tree pval = arg->tree_value; +@@ -4345,14 +4345,22 @@ store_one_arg (arg, argblock, flags, var + emit_move_insn (arg->save_area, stack_area); + } + } ++ ++ /* Now that we have saved any slots that will be overwritten ++ by this store, mark all slots this store will use. We ++ must do this before we actually expand the argument since ++ the expansion itself may trigger library calls which might ++ need to use the same stack slot. We only do it if we can't ++ pass all arguments to a library call in registers. */ ++ if (arg->partial) ++ { ++ for (i = lower_bound; i < upper_bound; i++) ++ stack_usage_map[i] = 1; ++ ++ /* Set it so that we don't do it again. */ ++ variable_size = 1; ++ } + } +- /* Now that we have saved any slots that will be overwritten by this +- store, mark all slots this store will use. We must do this before +- we actually expand the argument since the expansion itself may +- trigger library calls which might need to use the same stack slot. */ +- if (argblock && ! variable_size && arg->stack) +- for (i = lower_bound; i < upper_bound; i++) +- stack_usage_map[i] = 1; + } + + /* If this isn't going to be placed on both the stack and in registers, +@@ -4579,6 +4587,11 @@ store_one_arg (arg, argblock, flags, var + arg->value = arg->stack_slot; + } + ++ if (ACCUMULATE_OUTGOING_ARGS && !(flags & ECF_SIBCALL) ++ && argblock && ! variable_size && arg->stack) ++ for (i = lower_bound; i < upper_bound; i++) ++ stack_usage_map[i] = 1; ++ + /* Once we have pushed something, pops can't safely + be deferred during the rest of the arguments. */ + NO_DEFER_POP;