-----From: Ludolf Holzheid [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 18, 2007 1:21 PM
To: [email protected]; Discussions about the Splint
annotation-assisted static analysis project
Cc: Keith Prickett
Subject: Re: [splint-discuss] RE: Help on "Storage x may become null"
error
> On Wed, 2007-04-18 09:10:50 -0700, Keith Prickett wrote:
> > [..]
> > I am just not seeing where "listOfMyOwnType" may become null.
> > [..]
>
> I think the problem is, splint knows listOfMyOwnType[1] being NULL
> and warns about this fact. However, there seems to be no code
annotation
> for the object a pointer points to. i.e., if you write the prototype
for
> initializeItem1() as follows:
This may be true, except splint contains about the line where an
assignment to listOfMyOwnType[0] is occuring. The Splint warning is:
Index of possibly null pointer listOfMyOwnType: listOfMyOwnType
A possibly null pointer is dereferenced. Value is either the result
of a
function which may return null (in which case, code should check it is
not
null), or a global, parameter or structure field declared with the
null
qualifier. (Use -nullderef to inhibit warning)
This again, is the warning message when the assignment to
listOfMyOwnType[0] is occuring, not 1.
So I am still perplexed on this warning.
However, I did realize, due to your response, that splint doesn't
realize I am checking the "out" value from the "initializeItem1"
function with an ASSERT so I added code like follows and the second set
of warnings went away:
if ( (listOfMyOwnType[0] != NULL) && (listOfMyOwnType[1] != NULL))
{
useMyOwnList( listOfMyOwnType );
}
else
{
...
}
I can't get Splint to recognize my "ASSERT" (instead of using "ifs" like
above) but that's for a different topic.
Thanks again and in advance,
--
Keith
_______________________________________________
splint-discuss mailing list
[email protected]
http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss