Re: [PATCH 1/1] s390/dasd: fix string length handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 29, 2023 at 1:32 AM David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> From: Heiko Carstens
> > Sent: 29 August 2023 08:49
> >
> > On Mon, Aug 28, 2023 at 03:51:00PM -0700, Nick Desaulniers wrote:
> > > On Mon, Aug 28, 2023 at 05:18:37PM +0000, David Laight wrote:
> > > > From: Heiko Carstens
> > > > > Sent: 28 August 2023 16:32
> > > > >         if (strlen(uid.vduit) > 0)
> > > >
> > > > Does the compiler know enough to optimise that brain-dead test?
> > > >
> > >
> > > For the purposes of skipping diagnostics, no; clang performs semantic
> > > analysis BEFORE optimization (which is handled by LLVM). As such, clang
> > > will produce diagnostics on dead code.
> > >
> > > Partly because LLVM isn't very ergonomic at emitting diagnostics from
> > > the backend, partly because Clang code owner and developers don't want
> > > clang to emit diagnostics dependent on optimization level.
> > >
> > > I disagree with my compatriots, and you can read more thoughts here:
> > > https://discourse.llvm.org/t/rfc-improving-clangs-middle-and-back-end-
> > diagnostics/69261?u=nickdesaulniers
> >
> > Maybe I misunderstand what you write above, however clang (latest+greatest)
> > does indeed optimize the strlen() away and generates code which only tests
> > if uid.vduit[0] is zero or not.
> >
> > Unlike gcc, which does not optimize this away and which uses the strlen()
> > inline assembly provided via string.h...
>
> And, if -ffreestanding is set (as in some kernel builds), the compiler
> can't assume what strlen() does.

Exactly.

But triple checking if -ffreestanding is being used in arch/s390/ I only see:

arch/s390/purgatory/Makefile
26:KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding

arch/s390/Makefile
28:KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding

---
So I don't think -ffreestanding is at play here.
-- 
Thanks,
~Nick Desaulniers




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux