public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: phoebe.pf.w@gmail.com, Arnd Bergmann <arnd@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] power: reset: ltc2952: fix float conversion error
Date: Tue, 7 Dec 2021 12:21:40 -0700	[thread overview]
Message-ID: <Ya+0RKps7oAvdWl8@archlinux-ax161> (raw)
In-Reply-To: <CAKwvOdkxFrO0+WWqcQ9ZVHbT+TVpks1gE-SWG8yUF5U7E+HPHw@mail.gmail.com>

On Tue, Dec 07, 2021 at 11:16:31AM -0800, Nick Desaulniers wrote:
> (Minus most folks, plus Phoebe)
> 
> On Tue, Dec 7, 2021 at 11:06 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On Tue, Dec 07, 2021 at 10:41:24AM -0800, Nick Desaulniers wrote:
> > > On Sat, Dec 4, 2021 at 2:02 PM Arnd Bergmann <arnd@kernel.org> wrote:
> > > >
> > > > From: Arnd Bergmann <arnd@arndb.de>
> > > >
> > > > clang-14 does not like the way this driver converts a 'long double'
> > > > to an integer when the target architecture disables floating point
> > > > support:
> > > >
> > > > drivers/power/reset/ltc2952-poweroff.c:162:28: error: expression requires  'long double' type support, but target 'x86_64-unknown-linux' does not support it
> > > >         data->wde_interval = 300L * 1E6L;
> > > >                                   ^
> > > >
> > > > Turn this into pure integer math and make it more readable at the
> > > > same time using the NSEC_PER_MSEC macro instead.
> > > >
> > > > Fixes: 6647156c00cc ("power: reset: add LTC2952 poweroff driver")
> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > >
> > > Thanks for the patch! The change in clang-14 (ToT) that triggered this
> > > has had another patch on top reverting these diagnostics.
> > > https://reviews.llvm.org/D114162
> >
> > I can still reproduce this failure on current ToT (33e3554ea33d) on
> > x86_64 allmodconfig; it seems like that patch only fixes it for 32-bit
> > x86.
> 
> As a heads up Phoebe, in case there's any interest in doing something
> similar to https://reviews.llvm.org/D114162 but for 64b.

Phoebe pointed out on our issue tracker that GCC will error when long
double is used with -mno-80837 as well:

https://github.com/ClangBuiltLinux/linux/issues/1497#issuecomment-983245202

It just appears that GCC is able to avoid these errors in the particular
cases that the kernel triggers in clang:

https://github.com/ClangBuiltLinux/linux/issues/1497#issuecomment-983739365

Cheers,
Nathan

      reply	other threads:[~2021-12-07 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 22:01 [PATCH] power: reset: ltc2952: fix float conversion error Arnd Bergmann
2021-12-07 18:41 ` Nick Desaulniers
2021-12-07 19:00   ` Nick Desaulniers
2021-12-07 19:05   ` Nathan Chancellor
2021-12-07 19:16     ` Nick Desaulniers
2021-12-07 19:21       ` Nathan Chancellor [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=Ya+0RKps7oAvdWl8@archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=ndesaulniers@google.com \
    --cc=phoebe.pf.w@gmail.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