[splint-discuss] How to check Uninitialized variable
Nido
nido at foxserver.be
Tue May 12 06:16:03 PDT 2009
Here's a hack I used for another project
/* Yes this is meant to be uninitialised */
unsigned int seed = (unsigned int)&seed;
2009/5/12 Sebastian Waschik <sebastian.waschik at gmx.de>:
> Hello,
>
> Vijayendra Suman <vijayendra.suman at gmail.com> writes:
>> Hello All,
>> Thanks for the prompt response,
>> Here is the small piece of code this is compilable
>> 1 #include <stdio.h>
>> 2 void Call(int *a)
>> 3 {
>> 4 int StatusUpdate;
>> 5 int MyOne()
>> 6 {
>
> Two problems:
> 1. You use sometimes use not a real blank (0x20) but a chracter that
> looks like a blank (0xa0).
>
> 2. In C it is not allowed to definie functions inside other
> functions. I did not even know gcc accepts this.
>
>
> With cleanup a get the following messages. Source code follows.
>
> Greetings from Hamburg
> Sebastian Waschik
>
>
> Splint 3.1.1 --- 21 Apr 2006
>
> test.c: (in function main)
> test.c:26: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)
> test.c:23:14: Parameter argc not used
> A function parameter is not used in the body of the function. If the argument
> is needed for type compatibility or future plans, use /*@unused@*/ in the
> argument declaration. (Use -paramuse to inhibit warning)
> test.c:23:27: Parameter argv not used
> test.c:2:5: Variable exported but not used outside test: StatusUpdate
> A declaration is exported, but not used outside this module. Declaration can
> use static qualifier. (Use -exportlocal to inhibit warning)
> test.c:3:5: Function exported but not used outside test: MyOne
> test.c:7:1: Definition of MyOne
> test.c:8:5: Function exported but not used outside test: MyTwo
> test.c:12:1: Definition of MyTwo
> test.c:14:6: Function exported but not used outside test: Call
> test.c:21:1: Definition of Call
>
>
> #include <stdio.h>
> int StatusUpdate;
> int MyOne()
> {
> printf("One \n");
> return 1;
> }
> int MyTwo()
> {
> printf("Two \n");
> return 2;
> }
>
> void Call(int *a)
> {
> if (a==NULL) return;
> if (*a == 1 )
> StatusUpdate = MyOne();
> else
> StatusUpdate = MyTwo();
> }
>
> int main(int argc, char * argv[])
> {
> int call; /* call is not initialized */
> Call(&call);
> return 0;
> }
>
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at mail.cs.virginia.edu
> http://www.cs.virginia.edu/mailman/listinfo/splint-discuss
>
More information about the splint-discuss
mailing list