[splint-discuss] How to check Uninitialized variable
Vijayendra Suman
vijayendra.suman at gmail.com
Tue May 12 05:59:05 PDT 2009
Hi,
Thanks for the response, this gives me what I wanted to check.
Actually, I wanted to run splint on glibc code, specially the loader code.
Do you think it is possible to check such functions with splint, I would
like to give this extension.
Also, I want to get the same result from a CPP code, I will try to use the
splint code to get this result. Do any one has suggestion for it.
Regards
Vijayendra Suman
On Tue, May 12, 2009 at 6:02 PM, Ludolf Holzheid <
lholzheid at bihl-wiedemann.de> wrote:
> On Tue, 2009-05-12 16:52:44 +0530, Vijayendra Suman wrote:
> > Hello All,
> >
> > Thanks for the prompt response,
> >
> > Here is the small piece of code this is compilable
> > [..]
>
> If you move the nested functions out of Call() like this:
>
> >> #include <stdio.h>
> >>
> >> static int MyOne(void)
> >> {
> >> printf("One \n");
> >> return 1;
> >> }
> >>
> >> static int MyTwo(void)
> >> {
> >> printf("Two \n");
> >> return 2;
> >> }
> >>
> >> static void Call(int *a)
> >> {
> >> int StatusUpdate;
> >> if (a==NULL) return;
> >> if (*a == 1 )
> >> StatusUpdate = MyOne();
> >> else
> >> StatusUpdate = MyTwo();
> >> }
> >>
> >> int main(void)
> >> {
> >> int call; /* call is not initialized */
> >> Call(&call);
> >> return 0;
> >> }
>
> and run the result through splint, you will get the following:
>
> >> $ /c/Program\ Files/splint-3.1.1/bin/splint y.c
> >> Splint 3.1.1 --- 12 April 2003
> >>
> >> y.c: (in function main)
> >> y.c(28,8): Passed storage &call not completely defined: Call (&call)
> >> Storage derivable from a parameter, return value or global is not
> >> defined.
> >> Use /*@out@*/ to denote passed or returned storage which need not be
> >> defined.
> >> (Use -compdef to inhibit warning)
> >>
> >> Finished checking --- 1 code warning
>
> That is, splint _does_ complain about using 'call' without prior
> initialization.
>
> Does this answer your question?
>
> Ludolf
>
> --
>
> ---------------------------------------------------------------
> Ludolf Holzheid Tel: +49 621 339960
> Bihl+Wiedemann GmbH Fax: +49 621 3392239
> Floßwörthstraße 41 e-mail: lholzheid at bihl-wiedemann.de
> D-68199 Mannheim, Germany
> ---------------------------------------------------------------
>
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at mail.cs.virginia.edu
> http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
>
--
https://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy
Regards
Vijayendra Suman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090512/0fce322e/attachment-0003.html
More information about the splint-discuss
mailing list