[PATCH] sandbox: p2sb: Silence compiler warning

Stephen Warren swarren at wwwdotorg.org
Mon Feb 10 19:27:58 CET 2020


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.

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.


More information about the U-Boot mailing list