On 11/24/2015 04:12 PM, Kyrill Tkachov wrote:
arg->value to the stack frame at argblock.
arg->value is:
(mem/c:BLK (plus:SI (reg/f:SI 104 virtual-incoming-args)
         (const_int 20 [0x14])) [1 from+0 S20 A32])

and argblock is:
(plus:SI (reg/f:SI 104 virtual-incoming-args)
     (const_int 16 [0x10]))

Looking around, that '16' is crtl->args.pretend_args_size.

This patch fixes the issue by looking at the sum of
arg->locate.offset.constant and
crtl->args.pretend_args_size rather than just arg->locate.offset.constant.

Ok, I have this in gdb now trying to understand the issue.

Isn't the problem simply that we're comparing two values and one of them is offset by pretend_args_size? I.e. after this,

    if (XEXP (x, 0) != crtl->args.internal_arg_pointer)
      i = INTVAL (XEXP (XEXP (x, 0), 1));

shouldn't it be sufficient to just undo the pretend_args_size offset like this:

/* arg.locate doesn't contain the pretend_args_size offset, it's part of
   argblock.  Ensure we don't count it in I.  */
#ifdef STACK_GROWS_DOWNWARD
  i -= crtl->args.pretend_args_size
#else etc.


Bernd

Reply via email to