public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Honggyu Kim <hong.gyu.kim@lge.com>
Subject: Re: [PATCH][expr.c] PR 65358 Avoid clobbering partial argument during sibcall
Date: Tue, 21 Apr 2015 08:30:00 -0000	[thread overview]
Message-ID: <55360AA0.9070106@arm.com> (raw)
In-Reply-To: <55353F25.9010906@redhat.com>


On 20/04/15 19:02, Jeff Law wrote:
> On 04/20/2015 02:25 AM, Kyrill Tkachov wrote:
>> Hi Jeff,
>>> Hmmm, so what happens if the difference is < 0?   I'd be a bit worried
>>> about that case for the PA (for example).
>>>
>>> So how about asserting that the INTVAL is >= 0 prior to returning so
>>> that we catch that case if it ever occurs?
>> INTVAL being >= 0 is the case that I want to catch with this function.
>> INTVAL <0 is the usual case on leaf call optimisation. On arm, at least,
>> it means that x and y use the same base register (i.e. same stack frame)
>> but the offsets are such that reading SIZE bytes from X will not overlap
>> with Y, thus not requiring the workaround in this patch.
>> Thus, asserting that the result is positive is not right here.
>>
>> What characteristic on pa makes this problematic? Is it the
>> STACK_GROWS_UPWARD?
> Yea or more correctly that {STACK,FRAME}_GROWS_UPWARD and
> ARGS_GROW_DOWNWARD.  I think the stormy16 may have downward growing args
> too.
>
>
>> Should I then extend this function to do something like:
>>
>> HOST_WIDE_INT res = INTVAL (sub);
>> #ifndef STACK_GROWS_DOWNWARD
>> res = -res;
>> #endif
>>
>> return res?
> It certainly feels like something is needed for targets where growth is
> in the opposite direction -- but my guess is that without a concrete
> case that triggers on those targets (just the PA in 64 bit mode and
> stormy?) we'll probably get it wrong in one way or another.  Hence my
> suggestion that we assert rather than try to handle it and silently
> generate incorrect code in the process.

However, this function is expected to return negative numbers
when there is no overlap i.e. in the vast majority of cases when this
bug doesn't manifest. So asserting that it's positive is just
going to ICE at -O2 in almost any code.

 From reading config/stormy16/stormy-abi it seems to me that we don't
pass arguments partially in stormy16, so this code would never be called
there. That leaves pa as the potential problematic target.
I don't suppose there's an easy way to test on pa? My checkout of binutils
doesn't seem to include a sim target for it.

Kyrill

>
>
> Jeff
>

  reply	other threads:[~2015-04-21  8:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 14:39 Kyrill Tkachov
2015-03-27 10:06 ` Kyrill Tkachov
2015-03-29 11:29 ` Honggyu Kim
2015-04-13 14:01 ` Kyrill Tkachov
2015-04-13 16:33   ` Jeff Law
2015-04-17 17:26 ` Jeff Law
2015-04-20  8:25   ` Kyrill Tkachov
2015-04-20 18:02     ` Jeff Law
2015-04-21  8:30       ` Kyrill Tkachov [this message]
2015-04-21 14:09         ` Jeff Law
2015-04-21 17:33           ` Kyrill Tkachov
2015-04-22 11:51             ` Kyrill Tkachov
2015-04-27 10:12               ` Kyrill Tkachov
2015-04-27 13:16                 ` John David Anglin
2015-05-06 18:57                   ` John David Anglin
2015-04-27 20:13             ` Jeff Law
2015-04-28 10:19               ` Kyrill Tkachov
2015-04-30 12:09                 ` Kyrill Tkachov
2015-05-01 18:51                 ` Jeff Law
2015-05-11  9:28                   ` Kyrill Tkachov
2015-05-12 22:12                     ` Jeff Law
2015-05-27 14:00                       ` Kyrill Tkachov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55360AA0.9070106@arm.com \
    --to=kyrylo.tkachov@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hong.gyu.kim@lge.com \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).