Re: Possible Incorrect Pointer Reference in variable.c

Paul Smith <[email protected]> Mon, 27 Sep 2021 16:39:26 -0400
Newsgroups gmane.comp.gnu.make.devel
Organization GNU's Not UNIX!
Message-ID <[email protected]>
On Mon, 2021-09-27 at 11:48 -0700, Jon Forrest wrote:
> In the latest rev of variable.c starting at line #1637 I see:
> 
> -----
> 1637 struct variable *
> 1638 try_variable_definition (const floc *flocp, const char *line,
> 1639                          enum variable_origin origin, int
> target_var)
> 1640 {
> 1641   struct variable v;
> 1642   struct variable *vp;
> 1643
> 1644   if (flocp != 0)
> 1645     v.fileinfo = *flocp;
> 1646   else
> 1647     v.fileinfo.filenm = 0;
> -----
> 
> How can line #1647 ever work? "v" is a newly
> created local variable, which means "v.fileinfo"
> hasn't been given a value yet, which means that
> "v.fileinfo.filenm" could be anywhere.

It could be any value, that's true.  But we are assigning it here, not
using it so...?

Maybe I'm misunderstanding the problem you're pointing to.