From bdd3e6abedb77356422ad57820d0c81ee117f800 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Mon, 9 Mar 1998 12:03:21 +0000 Subject: [PATCH] Patch to fix mips64-elf varargs aliasing failures. * function.c (put_reg_into_stack): Copy MEM_IN_STRUCT_P from new. (assign_parms): Set aggregate if hide_last_arg and last_named. From-SVN: r18450 --- gcc/ChangeLog | 5 +++++ gcc/function.c | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 406cd47967d..53b06392562 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 9 12:02:23 1998 Jim Wilson + + * function.c (put_reg_into_stack): Copy MEM_IN_STRUCT_P from new. + (assign_parms): Set aggregate if hide_last_arg and last_named. + Mon Mar 9 19:57:56 1998 J"orn Rennecke * final.c (shorten_branches): Initialize insn_addresses. diff --git a/gcc/function.c b/gcc/function.c index 5c3198fa262..192bc5361a6 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1441,8 +1441,11 @@ put_reg_into_stack (function, reg, type, promoted_mode, decl_mode, volatile_p, PUT_CODE (reg, MEM); /* If this is a memory ref that contains aggregate components, - mark it as such for cse and loop optimize. */ - MEM_IN_STRUCT_P (reg) = AGGREGATE_TYPE_P (type); + mark it as such for cse and loop optimize. If we are reusing a + previously generated stack slot, then we need to copy the bit in + case it was set for other reasons. For instance, it is set for + __builtin_va_alist. */ + MEM_IN_STRUCT_P (reg) = AGGREGATE_TYPE_P (type) | MEM_IN_STRUCT_P (new); /* Now make sure that all refs to the variable, previously made when it was a register, are fixed up to be valid again. */ @@ -3650,6 +3653,12 @@ assign_parms (fndecl, second_time) #else int named_arg = ! last_named; #endif + /* If this is a varargs function, then we want to treat the last named + argument as if it was an aggregate, because it might be accessed as + one by the va_arg macros. This is necessary to make the aliasing + code handle this parm correctly. */ + if (hide_last_arg && last_named) + aggregate = 1; if (TREE_TYPE (parm) == error_mark_node /* This can happen after weird syntax errors -- 2.30.2