public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] diagnose unsupported uses of hardware register variables (PR 88000)
Date: Thu, 15 Nov 2018 22:34:00 -0000	[thread overview]
Message-ID: <6b554e92-38f7-ae5b-8696-09ff31247f13@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.13.1811141104130.7849@monopod.intra.ispras.ru>

On 11/14/2018 02:39 AM, Alexander Monakov wrote:
> On Tue, 13 Nov 2018, Martin Sebor wrote:
>
>> In PR 88000 the reporter expects to be able to use an explicit
>> register local variable in a context where it isn't supported
>> i.e., for something other than an input or output of an asm
>> statement: namely to pass it as argument to a user-defined
>> function.  GCC emits unexpected object code in this case which
>> the reporter thought was a GCC bug.
>
> I appreciate warnings for misuse of extensions in general, but in
> this particular case I think GCC's behavior is misdesigned, so
> instead of enshrining a bad engineering choice in a warning and
> in the manual, I'd rather see GCC implement the extension sanely.
>
> Merely changing a normal auto variable to a register asm variable
> should not invalidate the program. As the manual says, it should
> amount to providing a hint to the register allocator, at most.
>
> Have a look at PR 87984, where code is miscompiled despite following
> the documentation to the letter. This is because we lower accesses to
> register variables when transitioning from GIMPLE to RTL incorrectly.
> Fixing that should make the warning unnecessary. I hope I can work on
> that before stage 4.
>
> I think LLVM is doing the right thing there, and so should we.

That would indeed be preferable but it's not something I expect
to have the cycles to work on.  I put the patch together only
because it seemed like an easy way to help keep users from
shooting themselves in the foot (to borrow the phrase from
the comment in PR 88000).

If there's consensus that the general use case of passing hard
registers to functions should be supported then I suggest to
acknowledge PR 88000 as a bug.  We can discuss whether it's
possible and worthwhile to warn on the unsupported subset of
the use cases.  In any case, I think the least we can for now
is to clarify in the manual what that supported subset is,
since as I (and others) read it, passing hard registers to
functions is not.

Martin

  reply	other threads:[~2018-11-15 22:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14  4:11 Martin Sebor
2018-11-14  9:39 ` Alexander Monakov
2018-11-15 22:34   ` Martin Sebor [this message]
2018-11-14  9:48 ` Jakub Jelinek
2018-11-14 11:35   ` Segher Boessenkool
2018-11-14 11:40     ` Jakub Jelinek
2018-11-14 11:50       ` Segher Boessenkool
2018-11-14 12:00         ` Jakub Jelinek
2018-11-14 12:11           ` Segher Boessenkool
2018-11-14 12:14             ` Jakub Jelinek
2018-11-15 18:31   ` Martin Sebor
2018-11-14 12:22 Segher Boessenkool
2018-11-14 12:27 ` Jakub Jelinek
2018-11-14 12:33   ` Alexander Monakov
2018-11-14 13:53     ` Segher Boessenkool
2018-11-14 15:50       ` Alexander Monakov
2018-11-14 17:47         ` Segher Boessenkool
2018-11-14 18:01           ` Alexander Monakov
2018-11-15 15:54             ` Michael Matz
2018-11-15 16:23               ` Alexander Monakov
2018-11-16 15:21                 ` Michael Matz
2018-11-16 16:28                   ` Alexander Monakov
2018-11-16 16:43                     ` Michael Matz
2018-11-16 22:12               ` Segher Boessenkool
2018-11-19 12:59                 ` Michael Matz
2018-11-19 17:18                   ` Segher Boessenkool
2018-11-14 13:47   ` Segher Boessenkool

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=6b554e92-38f7-ae5b-8696-09ff31247f13@gmail.com \
    --to=msebor@gmail.com \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    /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).