[PATCH] sandbox: p2sb: Silence compiler warning

Simon Glass sjg at chromium.org
Mon Feb 10 20:03:26 CET 2020


Hi Stephen.

On Mon, 10 Feb 2020 at 11:28, Stephen Warren <swarren at wwwdotorg.org> wrote:
>
> On 2/8/20 8:21 AM, Bin Meng wrote:
> > On Sat, Feb 8, 2020 at 10:53 PM Simon Glass <sjg at chromium.org> wrote:
> >>
> >> Some compilers produce a warning about 'child' being used before init.
> >> Silence this by setting to NULL at the start.
> >
> > Should be a compiler bug I think. Which compiler has such issue?
>
> gcc 7.2.1 (Linaro build x86 -> ARM cross-compiler)
>
> I don't believe this is a compiler bug.

Well it is 'fixed' in 7.3.

>
> For the compiler *not* to emit this warning, it would have to apply
> cross-function data flow analysis, which isn't something guaranteed by
> the C standard IIRC, since it's a very hard problem in general. So, not
> a compiler *bug* even if we'd like to see the compiler be smart about
> these things.

Yes it is hard. I do think it is worth avoiding these problems where
we can. But in general I build with the latest kernel toolchain. I
think, sadly, if we really want to solve this problem we may need a
way to make buildman automatically build with multiple toolchains.

Regards,
Simon


More information about the U-Boot mailing list