lkml.org 
[lkml]   [2021]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] nubus: Simplify check in remove callback
On Tue, 27 Jul 2021, Geert Uytterhoeven wrote:

> On Tue, Jul 27, 2021 at 11:50 AM Finn Thain <fthain@linux-m68k.org> wrote:
> > On Tue, 27 Jul 2021, Uwe Kleine-König wrote:
> > > Apart from that, the compiler might already assume dev->driver being
> > > non-NULL after to_nubus_driver(dev->driver) was called.
> >
> > I don't understand how a compiler can make that assumption. But then,
> > I don't know why compilers do a lot of the things they do...
>
> It is one of those recent optimizations people have been complaining
> about. Once you have dereferenced a pointer, compilers may remove all
> further NULL-checks, assuming they can't happen, as the code would have
> crashed anyway before due to the dereference.

But that's the point -- there is no dereference, just pointer arithmetic.

> Good luck running on bare metal with RAM at zero ;-)

Quite.
\
 
 \ /
  Last update: 2021-07-27 12:20    [W:2.726 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site