public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: "Fāng-ruì Sòng" <maskray@google.com>
Cc: Fangrui Song via Libc-alpha <libc-alpha@sourceware.org>,
	 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: [PATCH] stdlib/longlong.h: Remove lvalue to rvalue conversion
Date: Tue, 12 Oct 2021 09:59:24 +0200	[thread overview]
Message-ID: <87mtney8pv.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <CAFP8O3+sLdOEF9fXayh1Q8NT6cncJBm7SZxCAbXWEuNG06kETA@mail.gmail.com> (=?utf-8?B?IkbEgW5nLXJ1w6wgU8OybmciJ3M=?= message of "Tue, 12 Oct 2021 00:24:51 -0700")

* Fāng-ruì Sòng:

> On Mon, Oct 11, 2021 at 11:37 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * Fangrui Song via Libc-alpha:
>>
>> > An output constraint takes a lvalue. While GCC happily strips the
>> > incorrect lvalue to rvalue conversion, Clang Clang rejects the code by
>> > default:
>> >
>> >     error: invalid use of a cast in a inline asm context requiring an lvalue: remove the cast or build with -fheinous-gnu-extensions
>>
>> As I wrote on the gcc-patches list, these casts may be needed in a few
>> cases.  Just removing them may not be entirely correct.
>
> You meant https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581265.html
>
> "This seems to alter the meanining of existing programs if sh and sl do
> not have the expected type.
> I think you need to add a compound expression and temporaries of type
> USItype if you want to avoid the cast."
>
>
> I tested this on x86-64 and aarch64 and saw no new failure.

It's probably not possible to show conclusively using testing alone
that the change is safe.  A type mismatch can only show up with
certain GCC versions or optimization levels.

The definitions of mp_limb_t and USItype are unfortunately different,
so it is hard to tell if all uses of these macros are still correct.

> In addition, using a compound statement sorta defeats the purpose to
> simplify the code.

I thought the actual goal was to get this to compile with Clang?
Clang does not support typed asm output operands, so the code is going
to turn more complex.

      reply	other threads:[~2021-10-12  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-10 22:14 Fangrui Song
2021-10-10 22:21 ` Andrew Pinski
2021-10-10 23:15   ` Fangrui Song
2021-10-11  8:55     ` Paul Zimmermann
2021-10-11 21:58     ` Joseph Myers
2021-10-12  6:35       ` Paul Zimmermann
2021-10-12 13:51         ` Joseph Myers
2021-10-12  6:31 ` Florian Weimer
2021-10-12  7:24   ` Fāng-ruì Sòng
2021-10-12  7:59     ` Florian Weimer [this message]

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=87mtney8pv.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.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).