Hello All, <br><br>Thanks for the prompt response,<br><br>Here is the small piece of code this is compilable<br><br><span style="color: rgb(0, 0, 153);"> 1 #include <stdio.h></span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 2 void Call(int *a)</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 3 {</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 4 int StatusUpdate;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 5 int MyOne()</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 6 {</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 7 printf("One \n");</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 8 return 1;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 9 }</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 10 int MyTwo()</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 11 {</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 12 printf("Two \n");</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 13 return 2;</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 14 }</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 15 if (a==NULL) return;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 16 if (*a == 1 )</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 17 StatusUpdate = MyOne();</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 18 else</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 19 StatusUpdate = MyTwo();</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 20 }</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 21</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 22 int main(int argc, char * argv[])</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 23 {</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 24 int call; /* call is not initialized */</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 25 Call(&call);</span><br style="color: rgb(0, 0, 153);">
<span style="color: rgb(0, 0, 153);"> 26 return 0;</span><br style="color: rgb(0, 0, 153);"><span style="color: rgb(0, 0, 153);"> 27 }</span><br><br>I compiled using <br>gcc -o my my.c -Wall<br><br>Problem definition:<br>
<span style="color: rgb(0, 0, 153);"> int call; /* call is not initialized */</span><br>The call variable is not initialized, Even with -Wall i do not get any warnings.<br><br>This is a problem as it may have any value. I want to make sure there are no such problems in my code which i can detect through the static analyzer.<br>
<br>I have tried using splint i get the following problem when i invoked splint<br><br>[root@localhost vijay]# splint -compdef 1.c<br>Splint 3.1.2 --- 13 Nov 2008<br><br>1.c:6:6: Parse Error. (For help on parse errors, see splint -help parseerrors.)<br>
*** Cannot continue.<br><br>I am not sure about this problem.<br><br>Splint :<br>Do we have some flags in splint which can detect this kind of errors, specially in such case <br><br><span style="color: rgb(0, 0, 153);"> 16 if (*a == 1 )</span><br>
<br>This line is a problem.<br><br>If there is some flags, that will be fine or if it is needed to done i can start with it.<br><br>With Sincere Regards<br>Vijayendra Suman<br><br><div class="gmail_quote">On Tue, May 12, 2009 at 4:03 PM, Ludolf Holzheid <span dir="ltr"><<a href="mailto:lholzheid@bihl-wiedemann.de">lholzheid@bihl-wiedemann.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Tue, 2009-05-12 15:06:08 +0530, Vijayendra Suman wrote:<br>
> [..]<br>
<div class="im">><br>
> Do we have a mechanism to check such kind of errors with splint tool.<br>
<br>
</div>Hmm.<br>
<br>
I tried to run your code snippet through splint. Among other messages<br>
it gave:<br>
<br>
> y.c(17,7): Passed storage &call not completely defined: Call (&call)<br>
> Storage derivable from a parameter, return value or global is not<br>
> defined.<br>
> Use /*@out@*/ to denote passed or returned storage which need not be<br>
> defined.<br>
> (Use -compdef to inhibit warning)<br>
<br>
Do you think this is wrong? Or what's your exact question?<br>
<br>
Ludolf<br>
<font color="#888888"><br>
--<br>
<br>
---------------------------------------------------------------<br>
Ludolf Holzheid Tel: +49 621 339960<br>
Bihl+Wiedemann GmbH Fax: +49 621 3392239<br>
Floßwörthstraße 41 e-mail: <a href="mailto:lholzheid@bihl-wiedemann.de">lholzheid@bihl-wiedemann.de</a><br>
D-68199 Mannheim, Germany<br>
---------------------------------------------------------------<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
splint-discuss mailing list<br>
<a href="mailto:splint-discuss@mail.cs.virginia.edu">splint-discuss@mail.cs.virginia.edu</a><br>
<a href="http://www.cs.virginia.edu/mailman/listinfo/splint-discuss" target="_blank">http://www.cs.virginia.edu/mailman/listinfo/splint-discuss</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="https://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy">https://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy</a><br>Regards <br>
Vijayendra Suman<br>