------- Comment #13 from hutchinsonandy at aim dot com 2008-06-01 02:40 ------- expr.c appears all messed up on emit_single_push_insn.
This bad code gets executed when there is no push instruction available. As well as getting address of the mem created completely wrong, it does not account for any offset between SP and Top/Bottom of Stack aka STACK_POINTER_OFFSET Any comment before I try and fix this mess? First example, ironically without the warning mentioned in latter code. else if (FUNCTION_ARG_PADDING (mode, type) == downward) { unsigned padding_size = rounded_size - GET_MODE_SIZE (mode); HOST_WIDE_INT offset; emit_move_insn (stack_pointer_rtx, expand_binop (Pmode, #ifdef STACK_GROWS_DOWNWARD sub_optab, #else add_optab, #endif stack_pointer_rtx, GEN_INT (rounded_size), NULL_RTX, 0, OPTAB_LIB_WIDEN)); offset = (HOST_WIDE_INT) padding_size; #ifdef STACK_GROWS_DOWNWARD if (STACK_PUSH_CODE == POST_DEC) /* We have already decremented the stack pointer, so get the previous value. */ ///NEXT LINE IS WRONG We are pointing just below value so we need SP + STACK_POINTER_OFFSET offset += (HOST_WIDE_INT) rounded_size; //For PRE_DEC we already point directly to mem so code OK #else if (STACK_PUSH_CODE == POST_INC) /* We have already incremented the stack pointer, so get the previous value. */ //NEXT LINE IS CORRECT offset -= (HOST_WIDE_INT) rounded_size; //For PRE_INC we now add STACK_POINTER_OFFSET or SP will be one lower than mem address #endif dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset)); } else The rest of code is even worse! -- hutchinsonandy at aim dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hutchinsonandy at aim dot | |com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27386