[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible variable used uninitialized in Lua 5.3
 
- From: Tim Hill <drtimhill@...>
 
- Date: Tue, 11 Nov 2014 11:01:21 -0800
 
> On Nov 11, 2014, at 7:25 AM, Steven Degutis <sbdegutis@gmail.com> wrote:
> 
> Quoth Philipp Janda:
>> Am 11.11.2014 um 15:25 schröbte Steven Degutis:
>>> 
>>> In ldebug.c at line 518 the variable "name" (declared at line 509)
>>> might have been uninitialized if the condition at line 512 was
>>> non-truthy.
>> 
>> 
>> `name` is only used if `kind` is set to a non-NULL value, and every
>> statement that could set `kind` to a non-NULL value (`getupvalname` and
>> `getobjname`) also initializes `name`.
>> Do you have a compiler that complains?
> 
> Yep, Xcode (which is to say, clang &| llvm).
> 
> -Steven
> 
Almost certainly a false-positive by the static analyzer (there are quite a few others in Lua). Assuming there really is no path that would use it uninitialized, you can silence the warning with an appropriate assert().
—Tim