From cbfalconer at yahoo.com Fri Apr 6 21:54:22 2007 From: cbfalconer at yahoo.com (CBFalconer) Date: Fri Apr 6 21:53:30 2007 Subject: [splint-discuss] How does splint check a pointer to constant References: Message-ID: <461723FE.B4839BCC@yahoo.com> Jorge Peixoto de Morais Neto wrote: > ... snip ... > > #include > int main(void){ > /*@unused@*/ char const * const teststringarray[]={"a"}; > return EXIT_SUCCESS; > } > , splint warns me that > > test.c: (in function main) > test.c:3:54: Read-only string literal storage used as initial > value for > unqualified storage: teststringarray[0] = "a" > A read-only string literal is assigned to a non-observer > reference. (Use > -readonlytrans to inhibit warning) > > , while gcc warns me of nothing (except that the variable > teststringarray is unused). > > The behavior in the program is bugging me (I have similar case in > a real program). Why does this happen? There is nothing wrong or > suspect in initializing with a string literal an array of const > pointers to constants (const * const) How can I fix this? In the > manual, I only found something about /*@observer@*/, but this > seems absurd, since I am not dealing with an abstract type. Add "-Wwrite-strings" to the gcc call, and it should warn you. -- "A man who is right every time is not likely to do very much." -- Francis Crick, co-discover of DNA "There is nothing more amazing than stupidity in action." -- Thomas Matthews From ibemed at gmail.com Mon Apr 9 15:39:59 2007 From: ibemed at gmail.com (=?ISO-8859-1?Q?Ib=E9ria_Medeiros?=) Date: Mon Apr 9 15:40:10 2007 Subject: [splint-discuss] Porting 32 to 64 bits Message-ID: <80bfbdd10704091539r19e447d5l6448da79ec24e45b@mail.gmail.com> Hi, I'am newbie with splint... and i like use the splint to give me warnings when i porting the 32 to 64 bits. The lint tool has a flag -errchk=longptr64 to do that, where warning when int = long int = (cast) ptr With splint, how i do that?? I know that -ignorequals flag in splint, catch the first case (int = long) and what a flag to second case?? Example: int a, c; long b; a = b; // -ignorequals warning here (int = long) c = 10; a = (int) &c; // what is the flag? (int = ptr) any help thanks, -- Ib?ria Medeiros -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20070409/76050e59/attachment.htm From ibemed at gmail.com Mon Apr 9 15:49:09 2007 From: ibemed at gmail.com (=?ISO-8859-1?Q?Ib=E9ria_Medeiros?=) Date: Mon Apr 9 15:49:20 2007 Subject: [splint-discuss] parse error Message-ID: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> hi, when i use the splint in the next code int a; int c; a = c; int b; b = a; the splint return a parse error.... i supose, maybe, because the declaration of _b_ is after a instruction (a = c). Because, if i declare _b_ before that instruction, splint dont give me any parse error. Why splint dont work with declarations of variables in any part of the program?? Exist any flag in splint to acept that?? Thanks, -- Ib?ria Medeiros -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20070409/cfddf8b0/attachment.htm From ai2097 at users.sourceforge.net Mon Apr 9 17:38:07 2007 From: ai2097 at users.sourceforge.net (Travis Snoozy) Date: Mon Apr 9 17:38:23 2007 Subject: [splint-discuss] parse error In-Reply-To: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> References: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> Message-ID: <20070409173807.06538cd5@localhost> On Mon, 9 Apr 2007 22:49:09 +0000, "Ib?ria Medeiros" wrote: > the splint return a parse error.... i supose, maybe, because the > declaration of _b_ is after a instruction (a = c). Because, if i > declare _b_ before that instruction, splint dont give me any parse > error. Why splint dont work with declarations of variables in any > part of the program?? Exist any flag in splint to acept that?? In ANSI C (C89), variable declarations must come first in your code. If you are using GCC, you can use the -ansi -pedantic set of switches to flag this behavior. At present, splint works only with C89, not C99. -- Travis From ai2097 at users.sourceforge.net Mon Apr 9 17:38:07 2007 From: ai2097 at users.sourceforge.net (Travis Snoozy) Date: Mon Apr 9 17:38:25 2007 Subject: [splint-discuss] parse error In-Reply-To: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> References: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> Message-ID: <20070409173807.06538cd5@localhost> On Mon, 9 Apr 2007 22:49:09 +0000, "Ib?ria Medeiros" wrote: > the splint return a parse error.... i supose, maybe, because the > declaration of _b_ is after a instruction (a = c). Because, if i > declare _b_ before that instruction, splint dont give me any parse > error. Why splint dont work with declarations of variables in any > part of the program?? Exist any flag in splint to acept that?? In ANSI C (C89), variable declarations must come first in your code. If you are using GCC, you can use the -ansi -pedantic set of switches to flag this behavior. At present, splint works only with C89, not C99. -- Travis From ibemed at gmail.com Mon Apr 9 17:51:51 2007 From: ibemed at gmail.com (=?ISO-8859-1?Q?Ib=E9ria_Medeiros?=) Date: Mon Apr 9 17:51:58 2007 Subject: [splint-discuss] parse error In-Reply-To: <20070409173807.06538cd5@localhost> References: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> <20070409173807.06538cd5@localhost> Message-ID: <80bfbdd10704091751u47d158e9n3a759068c005ee6c@mail.gmail.com> okay, if i understand, in first place i have to compile the program with C89 specifications (-ansi -pedantic) and after use the splint thanks, On 4/10/07, Travis Snoozy wrote: > > On Mon, 9 Apr 2007 22:49:09 +0000, "Ib?ria Medeiros" > wrote: > > > > the splint return a parse error.... i supose, maybe, because the > > declaration of _b_ is after a instruction (a = c). Because, if i > > declare _b_ before that instruction, splint dont give me any parse > > error. Why splint dont work with declarations of variables in any > > part of the program?? Exist any flag in splint to acept that?? > > > In ANSI C (C89), variable declarations must come first in your code. If > you are using GCC, you can use the -ansi -pedantic set of > switches to flag this behavior. At present, splint works only with C89, > not C99. > > -- > Travis > > _______________________________________________ > splint-discuss mailing list > splint-discuss@ares.cs.Virginia.EDU > http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss > -- Ib?ria Medeiros -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20070410/9b565719/attachment.htm From cbfalconer at yahoo.com Mon Apr 9 17:08:40 2007 From: cbfalconer at yahoo.com (CBFalconer) Date: Mon Apr 9 17:54:06 2007 Subject: [splint-discuss] parse error References: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com> Message-ID: <461AD588.59CE0429@yahoo.com> Ib?ria Medeiros wrote: > > Part 1.1.1 Type: Plain Text (text/plain) > Encoding: quoted-printable > > Part 1.2 Type: Plain Text (text/plain) > Encoding: 7bit Please do not use html in newsgroups or mailing lists. -- "A man who is right every time is not likely to do very much." -- Francis Crick, co-discover of DNA "There is nothing more amazing than stupidity in action." -- Thomas Matthews From Michael.Wojcik at MicroFocus.com Tue Apr 10 05:54:44 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Tue Apr 10 05:56:04 2007 Subject: [splint-discuss] parse error In-Reply-To: <80bfbdd10704091751u47d158e9n3a759068c005ee6c@mail.gmail.com> References: <80bfbdd10704091549p2c126c8aq4da4a6e215a347c6@mail.gmail.com><20070409173807.06538cd5@localhost> <80bfbdd10704091751u47d158e9n3a759068c005ee6c@mail.gmail.com> Message-ID: <11352F9641010A418AD5057945A3A6598B41D5@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Ib?ria Medeiros > Sent: Monday, 09 April, 2007 20:52 > if i understand, in first place i have to compile the program with > C89 specifications (-ansi -pedantic) and after use the splint No, you have to write your program to the C89 specification (ISO 9899:1989). Splint doesn't care how you compile it. The "-ansi" and "-pedantic" options for GCC will tell you if your program uses certain constructs that are not allowed in C89. You may find them useful, if you're writing C, using splint, and compiling with GCC. But they have no effect on splint itself. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From Michael.Wojcik at MicroFocus.com Tue Apr 10 05:54:52 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Tue Apr 10 05:59:32 2007 Subject: [splint-discuss] Porting 32 to 64 bits In-Reply-To: <80bfbdd10704091539r19e447d5l6448da79ec24e45b@mail.gmail.com> References: <80bfbdd10704091539r19e447d5l6448da79ec24e45b@mail.gmail.com> Message-ID: <11352F9641010A418AD5057945A3A6598B41D3@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Ib?ria Medeiros > Sent: Monday, 09 April, 2007 18:40 > I'am newbie with splint... and i like use the splint to give me warnings when i porting the 32 to 64 bits. > The lint tool has a flag -errchk=longptr64 to do that, where warning when > int = long > int = (cast) ptr *Some* lint tools have that flag. There are many lint implementations. > With splint, how i do that?? As far as I know, there's currently no splint check for assignment of a pointer type to an integer type with a (proper) cast. If you cast, splint generally assumes you know what you're doing. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From ibemed at gmail.com Tue Apr 10 06:43:30 2007 From: ibemed at gmail.com (=?ISO-8859-1?Q?Ib=E9ria_Medeiros?=) Date: Tue Apr 10 06:43:52 2007 Subject: [splint-discuss] Porting 32 to 64 bits In-Reply-To: <11352F9641010A418AD5057945A3A6598B41D3@MTV-EXCHANGE.microfocus.com> References: <80bfbdd10704091539r19e447d5l6448da79ec24e45b@mail.gmail.com> <11352F9641010A418AD5057945A3A6598B41D3@MTV-EXCHANGE.microfocus.com> Message-ID: <80bfbdd10704100643n6441fe69k1ff7f790d250d23@mail.gmail.com> On 4/10/07, Michael Wojcik wrote: > > From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Ib?ria Medeiros > > Sent: Monday, 09 April, 2007 18:40 > > > I'am newbie with splint... and i like use the splint to give me warnings when i porting the 32 to 64 bits. > > The lint tool has a flag -errchk=longptr64 to do that, where warning when > > int = long > > int = (cast) ptr > > *Some* lint tools have that flag. There are many lint implementations. > > > With splint, how i do that?? > > As far as I know, there's currently no splint check for assignment of a pointer type to an integer type with a (proper) cast. If you cast, splint generally assumes you know what you're doing. yes, this is true.. if iam development applications to 32 bits (data model ILP32), where sizeof(int) = sizeof(long) = sizeof(ptr) = 32 bits. If i build programs to 64 bits, to data model LP64, the size of integral types are diferents... sizeof(int) = 32bits and sizeof(long) = sizeof(ptr) = 64bits. The problem is when i porting 32 bits to 64 bits, the instructions int = long (32 = 64 bits, in LP64) lose bits, and splint with -ignorequals set warning me int = ptr or int = (cast)ptr (32 = 64 bits, in LP64), splint dont warning! There is any flag in splint that detect this? Thanks, -- Ib?ria Medeiros From Michael.Wojcik at MicroFocus.com Tue Apr 10 07:44:59 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Tue Apr 10 07:46:37 2007 Subject: [splint-discuss] Porting 32 to 64 bits In-Reply-To: <80bfbdd10704100643n6441fe69k1ff7f790d250d23@mail.gmail.com> References: <80bfbdd10704091539r19e447d5l6448da79ec24e45b@mail.gmail.com><11352F9641010A418AD5057945A3A6598B41D3@MTV-EXCHANGE.microfocus.com> <80bfbdd10704100643n6441fe69k1ff7f790d250d23@mail.gmail.com> Message-ID: <11352F9641010A418AD5057945A3A6598B41D8@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu > [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of > Ib?ria Medeiros > Sent: Tuesday, 10 April, 2007 09:44 > > On 4/10/07, Michael Wojcik wrote: > > As far as I know, there's currently no splint check for > > assignment of a pointer type to an integer type with a > > (proper) cast. If you cast, splint generally assumes you > > know what you're doing. > > The problem is when i porting 32 bits to 64 bits, the instructions > int = long (32 = 64 bits, in LP64) lose bits, and splint with > -ignorequals set warning me Yes, I understand all of that. I'm well aware of the issues with converting integral types in various 64-bit models. > int = ptr or int = (cast)ptr (32 = 64 bits, in LP64), splint dont > warning! There is any flag in splint that detect this? Not if you use the cast. That was the point of my previous message. Without the cast, splint will warn about the assignment by default. You have to specify "-type" to get splint to not warn about it. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From spam_account at sympatico.ca Tue Apr 10 18:16:42 2007 From: spam_account at sympatico.ca (spam_account@sympatico.ca) Date: Tue Apr 10 18:59:11 2007 Subject: [splint-discuss] CVS access to sourceforge? Message-ID: Could I have CVS access to source forge to accept patches posted to this mailing list? -- Schrodinger on QED: I don't like it, and I'm sorry I ever had anything to do with it. From elfring at users.sourceforge.net Wed Apr 11 09:12:01 2007 From: elfring at users.sourceforge.net (SF Markus Elfring) Date: Wed Apr 11 09:12:20 2007 Subject: [splint-discuss] CVS access to sourceforge? In-Reply-To: References: Message-ID: <461D08D1.2090000@users.sourceforge.net> > Could I have CVS access to source forge to accept patches posted to > this mailing list? The published link "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/splint/splint" does not work any more. Will a Subversion repository become available to improve the software situation? Regards, Markus From spam_account at sympatico.ca Wed Apr 11 12:37:50 2007 From: spam_account at sympatico.ca (Bill Pringlemeir) Date: Wed Apr 11 12:38:33 2007 Subject: [splint-discuss] CVS access to sourceforge? In-Reply-To: <461D08D1.2090000@users.sourceforge.net> References: <461D08D1.2090000@users.sourceforge.net> Message-ID: On 11 Apr 2007, elfring@users.sourceforge.net wrote: > The published link > "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/splint/splint" does > not work any more. Source forge is re-arranging things constantly. The link is here, "http://splint.cvs.sourceforge.net/splint/" This needs to change at "http://www.splint.org/". Sourceforge does not have rights to this server. -- The end of our foundation is knowledge of causes, and secret motions of things; and the enlarging of the bounds of human empire, to the effecting of all things possible. - Francis Bacon, New Atlantis From keithp at marvell.com Wed Apr 11 15:06:39 2007 From: keithp at marvell.com (Keith Prickett) Date: Wed Apr 11 15:24:30 2007 Subject: [splint-discuss] Splint and Vim Errorformat Message-ID: I am using Splint 3.1.1 and attempting to integrate it with gVIM on my Windows box. I have tried multiple errorformats but can't seem to find one that parses the Splint output properly. Has anyone had any experience with this that can lend some insight? I tried ":set efm=%f(%l\,%c):\ %m" among others. This doesn't seem to work. Thanks in advance, -- Keith Prickett From lholzheid at bihl-wiedemann.de Wed Apr 11 15:42:06 2007 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed Apr 11 15:44:23 2007 Subject: [splint-discuss] Splint and Vim Errorformat In-Reply-To: References: Message-ID: <20070411224206.GA832@svr5.bihl-wiedemann.de> On Wed, 2007-04-11 15:06:39 -0700, Keith Prickett wrote: > I am using Splint 3.1.1 and attempting to integrate it with gVIM on my > Windows box. I have tried multiple errorformats but can't seem to find > one that parses the Splint output properly. Has anyone had any > experience with this that can lend some insight? Hello Keith, I don't know anything about vi. However, I expect vi to be able to parse GNU-C-style error messages properly (see the "-paren-file-format" flag to splint). You might also experiment with "-show-column" and "-show-func". Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid@bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From Michael.Wojcik at MicroFocus.com Thu Apr 12 10:06:55 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Thu Apr 12 10:08:22 2007 Subject: [splint-discuss] Splint and Vim Errorformat In-Reply-To: <20070411224206.GA832@svr5.bihl-wiedemann.de> References: <20070411224206.GA832@svr5.bihl-wiedemann.de> Message-ID: <11352F9641010A418AD5057945A3A6598B41F5@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu > [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of > Ludolf Holzheid > Sent: Wednesday, 11 April, 2007 18:42 > > On Wed, 2007-04-11 15:06:39 -0700, Keith Prickett wrote: > > I am using Splint 3.1.1 and attempting to integrate it with gVIM on my > > Windows box. I have tried multiple errorformats but can't seem to find > > one that parses the Splint output properly. Has anyone had any > > experience with this that can lend some insight? > > I don't know anything about vi. However, I expect vi to be able to > parse GNU-C-style error messages properly (see the > "-paren-file-format" flag to splint). -paren-file-format does indeed appear to produce error messages that vim understands out of the box. (Plain vi doesn't have Quickfix mode; this is a vim extension.) I'm no expert on setting vim errorformats (I've never looked into it before now, actually), but the following seems to work, more or less, for Splint without -paren-file-format: :set errorformat=%A%f(%l\\,%c):\ %m,%+C\ %.%# That sets a multiline error format that begins with the line containing the filename followed by line and column number in parentheses, and continues with lines that begin with a space. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From keithp at marvell.com Thu Apr 12 14:23:49 2007 From: keithp at marvell.com (Keith Prickett) Date: Thu Apr 12 14:24:10 2007 Subject: [splint-discuss] Splint and Vim Errorformat In-Reply-To: <11352F9641010A418AD5057945A3A6598B41F5@MTV-EXCHANGE.microfocus.com> References: <20070411224206.GA832@svr5.bihl-wiedemann.de> <11352F9641010A418AD5057945A3A6598B41F5@MTV-EXCHANGE.microfocus.com> Message-ID: :set errorformat=%A%f(%l\\,%c):\ %m,%+C\ %.%# Seems to work pretty well, except files with windows paths are not recognized using %f. For example "foobar.c(line,column)" IS recognized and the error is shown using :cn and :cp. But the line containing "C:\foo\bar\foobar.c(line,colum)" is NOT recognized. Has anyone had any experience in this area? Thanks, -- Keith Prickett -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Michael Wojcik Sent: Thursday, April 12, 2007 10:07 AM To: Discussions about the Splint annotation-assisted static analysisproject Subject: RE: [splint-discuss] Splint and Vim Errorformat > From: splint-discuss-bounces@cs.virginia.edu > [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Ludolf > Holzheid > Sent: Wednesday, 11 April, 2007 18:42 > > On Wed, 2007-04-11 15:06:39 -0700, Keith Prickett wrote: > > I am using Splint 3.1.1 and attempting to integrate it with gVIM on my > > Windows box. I have tried multiple errorformats but can't seem to find > > one that parses the Splint output properly. Has anyone had any > > experience with this that can lend some insight? > > I don't know anything about vi. However, I expect vi to be able to > parse GNU-C-style error messages properly (see the > "-paren-file-format" flag to splint). -paren-file-format does indeed appear to produce error messages that vim understands out of the box. (Plain vi doesn't have Quickfix mode; this is a vim extension.) I'm no expert on setting vim errorformats (I've never looked into it before now, actually), but the following seems to work, more or less, for Splint without -paren-file-format: :set errorformat=%A%f(%l\\,%c):\ %m,%+C\ %.%# That sets a multiline error format that begins with the line containing the filename followed by line and column number in parentheses, and continues with lines that begin with a space. -- Michael Wojcik Principal Software Systems Developer, Micro Focus _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From Michael.Wojcik at MicroFocus.com Fri Apr 13 12:37:51 2007 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Fri Apr 13 12:39:12 2007 Subject: [splint-discuss] Splint and Vim Errorformat In-Reply-To: References: <20070411224206.GA832@svr5.bihl-wiedemann.de><11352F9641010A418AD5057945A3A6598B41F5@MTV-EXCHANGE.microfocus.com> Message-ID: <11352F9641010A418AD5057945A3A6598B4208@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu > [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of > Keith Prickett > Sent: Thursday, 12 April, 2007 17:24 > > :set errorformat=%A%f(%l\\,%c):\ %m,%+C\ %.%# Seems to work > pretty well, > except files with windows paths are not recognized using %f. For > example "foobar.c(line,column)" IS recognized and the error is shown > using :cn and :cp. But the line containing > "C:\foo\bar\foobar.c(line,colum)" is NOT recognized. Really? It works for me. This is (character-mode) Vim 6.3 on XP. I don't have gvim installed, so I can't test with it, but I'd be surprised if it was different. I note that the operation of the %f (filename) token depends on the setting of isfname, but I don't believe I've changed mine from the default. Here's what it is, just in case yours is different: isfname=@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,= Backslash and colon are both present, so full Windows pathnames should be (and, on my system, are) recognized by %f. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From keithp at marvell.com Mon Apr 16 20:09:45 2007 From: keithp at marvell.com (Keith Prickett) Date: Mon Apr 16 20:09:50 2007 Subject: [splint-discuss] Help on "Storage x may become null" error Message-ID: I've got code that looks kind of like this: ----------------- typedef struct { int a; int b; char c; } MY_OWN_TYPE; static MY_OWN_TYPE gAType; void init( void ) { // create a list of my own types MY_OWN_TYPE * listOfMyOwnType[2]; // initialize item 0 to non-null value listOfMyOwnType[0] = &gAType; // initialize item 1 to null value listOfMyOwnType[1] = NULL; // initializes item 1 to non-null value initializeItem1( &listOfMyOwnType[1] ); // ensure value is not null ASSERT( NULL != listOfMyOwnType[1] ); // pass list to function who wants list useMyOwnList( listOfMyOwnType ); return; } ---------------------------- First, Splint says: Possibly null storage listOfMyOwnType[] derivable from parameter useMyOwnList (..., listOfMyOwnType, ...)... Why would it say that? If it's what I think it is (complaining that a particular item _may_ be null), then how can I say that each of the items individually can be null. Second, Splint is reporting that Storage listOfMyOwnType[] may become null on the line where item 0 is assigned to the address of a static global. Why is it complaining about that? It seems like that would NEVER become null. Thanks, -- Keith Prickett From Francois.Isabelle at ca.kontron.com Tue Apr 17 08:17:59 2007 From: Francois.Isabelle at ca.kontron.com (Isabelle, Francois) Date: Tue Apr 17 08:18:26 2007 Subject: [splint-discuss] Help on "Storage x may become null" error In-Reply-To: Message-ID: It's not an error. As you sais, the item _may_ be null, and it instructs you to specify /*@null@*/ annotations for items that may become null. This can be added to return types, parameter types and variable declaration /*@null@*/ void* function(/*@null@*/ void * ptr) /*@null@*/ void* listofvoid[2]; Francois Isabelle >-----Original Message----- >From: splint-discuss-bounces@cs.virginia.edu >[mailto:splint-discuss-bounces@cs.virginia.edu]On Behalf Of Keith >Prickett >Sent: 16 avril, 2007 20:10 >To: splint-discuss@ares.cs.Virginia.EDU >Subject: [splint-discuss] Help on "Storage x may become null" error > > >I've got code that looks kind of like this: > >----------------- >typedef struct >{ > int a; > int b; > char c; >} MY_OWN_TYPE; > >static MY_OWN_TYPE gAType; > >void init( void ) >{ > > // create a list of my own types > MY_OWN_TYPE * listOfMyOwnType[2]; > > > // initialize item 0 to non-null value > listOfMyOwnType[0] = &gAType; > // initialize item 1 to null value > listOfMyOwnType[1] = NULL; > > > // initializes item 1 to non-null value > initializeItem1( &listOfMyOwnType[1] ); > // ensure value is not null > ASSERT( NULL != listOfMyOwnType[1] ); > > // pass list to function who wants list > useMyOwnList( listOfMyOwnType ); > > > return; >} >---------------------------- >First, Splint says: Possibly null storage listOfMyOwnType[] derivable >from parameter > useMyOwnList (..., listOfMyOwnType, ...)... >Why would it say that? If it's what I think it is (complaining that a >particular item _may_ be null), then how can I say that each of the >items individually can be null. > >Second, Splint is reporting that Storage listOfMyOwnType[] may become >null on the line where item 0 is assigned to the address of a static >global. Why is it complaining about that? It seems like that would >NEVER become null. > >Thanks, > >-- >Keith Prickett > > >_______________________________________________ >splint-discuss mailing list >splint-discuss@ares.cs.Virginia.EDU >http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss > From Francois.Isabelle at ca.kontron.com Tue Apr 17 08:17:59 2007 From: Francois.Isabelle at ca.kontron.com (Isabelle, Francois) Date: Tue Apr 17 08:19:37 2007 Subject: [splint-discuss] Help on "Storage x may become null" error In-Reply-To: Message-ID: It's not an error. As you sais, the item _may_ be null, and it instructs you to specify /*@null@*/ annotations for items that may become null. This can be added to return types, parameter types and variable declaration /*@null@*/ void* function(/*@null@*/ void * ptr) /*@null@*/ void* listofvoid[2]; Francois Isabelle >-----Original Message----- >From: splint-discuss-bounces@cs.virginia.edu >[mailto:splint-discuss-bounces@cs.virginia.edu]On Behalf Of Keith >Prickett >Sent: 16 avril, 2007 20:10 >To: splint-discuss@ares.cs.Virginia.EDU >Subject: [splint-discuss] Help on "Storage x may become null" error > > >I've got code that looks kind of like this: > >----------------- >typedef struct >{ > int a; > int b; > char c; >} MY_OWN_TYPE; > >static MY_OWN_TYPE gAType; > >void init( void ) >{ > > // create a list of my own types > MY_OWN_TYPE * listOfMyOwnType[2]; > > > // initialize item 0 to non-null value > listOfMyOwnType[0] = &gAType; > // initialize item 1 to null value > listOfMyOwnType[1] = NULL; > > > // initializes item 1 to non-null value > initializeItem1( &listOfMyOwnType[1] ); > // ensure value is not null > ASSERT( NULL != listOfMyOwnType[1] ); > > // pass list to function who wants list > useMyOwnList( listOfMyOwnType ); > > > return; >} >---------------------------- >First, Splint says: Possibly null storage listOfMyOwnType[] derivable >from parameter > useMyOwnList (..., listOfMyOwnType, ...)... >Why would it say that? If it's what I think it is (complaining that a >particular item _may_ be null), then how can I say that each of the >items individually can be null. > >Second, Splint is reporting that Storage listOfMyOwnType[] may become >null on the line where item 0 is assigned to the address of a static >global. Why is it complaining about that? It seems like that would >NEVER become null. > >Thanks, > >-- >Keith Prickett > > >_______________________________________________ >splint-discuss mailing list >splint-discuss@ares.cs.Virginia.EDU >http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss > From keithp at marvell.com Tue Apr 17 13:22:07 2007 From: keithp at marvell.com (Keith Prickett) Date: Tue Apr 17 13:22:19 2007 Subject: [splint-discuss] Help on "Storage x may become null" error In-Reply-To: References: Message-ID: Even if I add /*@null@*/ in front of the line: "MY_OWN_TYPE * listOfMyOwnType[2];" I still see the same warnings, plus some. This splint warning just doesn't make sense to me. I have declared a list of pointers. The list itself will never be null. The items in the list may be, but how does splint want me to deal with that? -- Keith Prickett -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Isabelle, Francois Sent: Tuesday, April 17, 2007 5:18 AM To: Discussions about the Splint annotation-assisted static analysisproject; splint-discuss@ares.cs.Virginia.EDU Subject: RE: [splint-discuss] Help on "Storage x may become null" error It's not an error. As you sais, the item _may_ be null, and it instructs you to specify /*@null@*/ annotations for items that may become null. This can be added to return types, parameter types and variable declaration /*@null@*/ void* function(/*@null@*/ void * ptr) /*@null@*/ void* listofvoid[2]; Francois Isabelle >-----Original Message----- >From: splint-discuss-bounces@cs.virginia.edu >[mailto:splint-discuss-bounces@cs.virginia.edu]On Behalf Of Keith >Prickett >Sent: 16 avril, 2007 20:10 >To: splint-discuss@ares.cs.Virginia.EDU >Subject: [splint-discuss] Help on "Storage x may become null" error > > >I've got code that looks kind of like this: > >----------------- >typedef struct >{ > int a; > int b; > char c; >} MY_OWN_TYPE; > >static MY_OWN_TYPE gAType; > >void init( void ) >{ > > // create a list of my own types > MY_OWN_TYPE * listOfMyOwnType[2]; > > > // initialize item 0 to non-null value listOfMyOwnType[0] = &gAType; > // initialize item 1 to null value listOfMyOwnType[1] = NULL; > > > // initializes item 1 to non-null value initializeItem1( > &listOfMyOwnType[1] ); // ensure value is not null ASSERT( NULL != > listOfMyOwnType[1] ); > > // pass list to function who wants list useMyOwnList( > listOfMyOwnType ); > > > return; >} >---------------------------- >First, Splint says: Possibly null storage listOfMyOwnType[] derivable >from parameter > useMyOwnList (..., listOfMyOwnType, ...)... >Why would it say that? If it's what I think it is (complaining that a >particular item _may_ be null), then how can I say that each of the >items individually can be null. > >Second, Splint is reporting that Storage listOfMyOwnType[] may become >null on the line where item 0 is assigned to the address of a static >global. Why is it complaining about that? It seems like that would >NEVER become null. > >Thanks, > >-- >Keith Prickett > > >_______________________________________________ >splint-discuss mailing list >splint-discuss@ares.cs.Virginia.EDU >http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss > _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From keithp at marvell.com Tue Apr 17 13:22:07 2007 From: keithp at marvell.com (Keith Prickett) Date: Tue Apr 17 13:51:21 2007 Subject: [splint-discuss] Help on "Storage x may become null" error In-Reply-To: References: Message-ID: Even if I add /*@null@*/ in front of the line: "MY_OWN_TYPE * listOfMyOwnType[2];" I still see the same warnings, plus some. This splint warning just doesn't make sense to me. I have declared a list of pointers. The list itself will never be null. The items in the list may be, but how does splint want me to deal with that? -- Keith Prickett -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Isabelle, Francois Sent: Tuesday, April 17, 2007 5:18 AM To: Discussions about the Splint annotation-assisted static analysisproject; splint-discuss@ares.cs.Virginia.EDU Subject: RE: [splint-discuss] Help on "Storage x may become null" error It's not an error. As you sais, the item _may_ be null, and it instructs you to specify /*@null@*/ annotations for items that may become null. This can be added to return types, parameter types and variable declaration /*@null@*/ void* function(/*@null@*/ void * ptr) /*@null@*/ void* listofvoid[2]; Francois Isabelle >-----Original Message----- >From: splint-discuss-bounces@cs.virginia.edu >[mailto:splint-discuss-bounces@cs.virginia.edu]On Behalf Of Keith >Prickett >Sent: 16 avril, 2007 20:10 >To: splint-discuss@ares.cs.Virginia.EDU >Subject: [splint-discuss] Help on "Storage x may become null" error > > >I've got code that looks kind of like this: > >----------------- >typedef struct >{ > int a; > int b; > char c; >} MY_OWN_TYPE; > >static MY_OWN_TYPE gAType; > >void init( void ) >{ > > // create a list of my own types > MY_OWN_TYPE * listOfMyOwnType[2]; > > > // initialize item 0 to non-null value listOfMyOwnType[0] = &gAType; > // initialize item 1 to null value listOfMyOwnType[1] = NULL; > > > // initializes item 1 to non-null value initializeItem1( > &listOfMyOwnType[1] ); // ensure value is not null ASSERT( NULL != > listOfMyOwnType[1] ); > > // pass list to function who wants list useMyOwnList( > listOfMyOwnType ); > > > return; >} >---------------------------- >First, Splint says: Possibly null storage listOfMyOwnType[] derivable >from parameter > useMyOwnList (..., listOfMyOwnType, ...)... >Why would it say that? If it's what I think it is (complaining that a >particular item _may_ be null), then how can I say that each of the >items individually can be null. > >Second, Splint is reporting that Storage listOfMyOwnType[] may become >null on the line where item 0 is assigned to the address of a static >global. Why is it complaining about that? It seems like that would >NEVER become null. > >Thanks, > >-- >Keith Prickett > > >_______________________________________________ >splint-discuss mailing list >splint-discuss@ares.cs.Virginia.EDU >http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss > _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From cbfalconer at yahoo.com Tue Apr 17 14:05:21 2007 From: cbfalconer at yahoo.com (CBFalconer) Date: Tue Apr 17 16:33:19 2007 Subject: [splint-discuss] Help on "Storage x may become null" error References: Message-ID: <46250C61.99332843@yahoo.com> Keith Prickett wrote: > > Even if I add /*@null@*/ in front of the line: "MY_OWN_TYPE * > listOfMyOwnType[2];" I still see the same warnings, plus some. > This splint warning just doesn't make sense to me. I have > declared a list of pointers. The list itself will never be null. > The items in the list may be, but how does splint want me to deal > with that? Please do not top-post. Your answer belongs after (or intermixed with) the quoted material to which you reply, after snipping all irrelevant material. See the following links: -- (taming google) (newusers) From Francois.Isabelle at ca.kontron.com Tue Apr 17 17:16:04 2007 From: Francois.Isabelle at ca.kontron.com (Isabelle, Francois) Date: Tue Apr 17 17:16:17 2007 Subject: [splint-discuss] Help on "Storage x may become null" error In-Reply-To: <46250C61.99332843@yahoo.com> Message-ID: > >Please do not top-post. Your answer belongs after (or intermixed >with) the quoted material to which you reply, after snipping all >irrelevant material. See the following links: > >-- > > > > (taming google) > (newusers) > So sorry, I whish you don't spend time around looking for offending users, I guess you could find a big number of sad outlook users. Thanks Francois Isabelle From wenzel at bbr-vt.de Wed Apr 18 02:31:14 2007 From: wenzel at bbr-vt.de (Wenzel, Bodo) Date: Wed Apr 18 05:39:14 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error Message-ID: <4625D752.28160.25C714@wenzel.bbr-vt.de> Would you mind to show us your splint commandline, the declarations and annotations for the called function, and so on, so that it's possible to reproduce your problem, please? Mit freundlichen Gr??en, Bodo Wenzel - Entwicklung Software - -- BBR - Baudis Bergmann R?sch Verkehrstechnik GmbH Pillaustra?e 1e D - 38126 Braunschweig T: +49.531.27300-766 F: +49.531.27300-999 @: wenzel@bbr-vt.de W: http://www.bbr-vt.de Registergericht: AG Braunschweig HRB 3037 Gesch?ftsf?hrer: Dipl.-Ing. Arne Baudis Dipl.-Ing. Thomas Bergmann Dipl.-Ing. Frank-Michael R?sch USt.-ID-Nr.: DE 114 877 881 From keithp at marvell.com Wed Apr 18 12:10:50 2007 From: keithp at marvell.com (Keith Prickett) Date: Wed Apr 18 12:10:55 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: <4625D752.28160.25C714@wenzel.bbr-vt.de> References: <4625D752.28160.25C714@wenzel.bbr-vt.de> Message-ID: ---Original Code/Message--- I've got code that looks kind of like this: ----------------- typedef struct { int a; int b; char c; } MY_OWN_TYPE; static MY_OWN_TYPE gAType; void init( void ) { // create a list of my own types MY_OWN_TYPE * listOfMyOwnType[2]; // initialize item 0 to non-null value listOfMyOwnType[0] = &gAType; // initialize item 1 to null value listOfMyOwnType[1] = NULL; // initializes item 1 to non-null value initializeItem1( &listOfMyOwnType[1] ); // ensure value is not null ASSERT( NULL != listOfMyOwnType[1] ); // pass list to function who wants list useMyOwnList( listOfMyOwnType ); return; } ---------------------------- -----Wenzel, Bodo Wrote----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Wenzel, Bodo Sent: Tuesday, April 17, 2007 11:31 PM To: splint-discuss@ares.cs.Virginia.EDU Subject: [splint-discuss] RE: Help on "Storage x may become null" error > Would you mind to show us your splint commandline, the declarations and annotations for the called function, > and so on, so that it's possible to reproduce your problem, please? I only have "splint +paren-file-format file.c" plus my include flags and defines for my own code. The "+paren-file-format" is because I am running on a WIN32 system. I think my biggest problem is that I don't understand why splint would think my variable "listOfMyOwnType" would EVER become NULL. Maybe I need to review the C-language. The above code is a snippet of code I wrote (and didn't test/compile) to match my scenario, but is not an exact replica of my code. I annotated the line during testing from: MY_OWN_TYPE * listOfMyOwnType[2]; to: /*@null@*/ MY_OWN_TYPE * listOfMyOwnType[2]; Before the annotation I get the warnings: """ Possibly null storage listOfMyOwnType[] derivable from parameter useMyOwnList (..., listOfMyOwnType, ...) A possibly null pointer is reachable from a parameter or global variable that is not declared using a /*@null@*/ annotation. (Use -nullstate to inhibit warning) """ Then: """ Storage listOfMyOwnType[] may become null. """ After I make the annotation I get the two previous warnings plus the following: """ 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) """ I am just not seeing where "listOfMyOwnType" may become null. If I put checks like: if (NULL != listOfMyOwnType) { listOfMyOwnType[0] = &gAType; } the warnings go away (surprise). I have to put this test around each use of the variable. This doesn't seem like a reasonable solution for the example given, that is why I sent an e-mail to the list, to figure out a reasonable solution. Thanks in advance, -- Keith Prickett From lholzheid at bihl-wiedemann.de Wed Apr 18 16:21:28 2007 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed Apr 18 16:21:42 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: References: <4625D752.28160.25C714@wenzel.bbr-vt.de> Message-ID: <20070418202128.GB16498@svr5.bihl-wiedemann.de> On Wed, 2007-04-18 09:10:50 -0700, Keith Prickett wrote: > [..] > I am just not seeing where "listOfMyOwnType" may become null. > [..] Keith, 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: void initializeItem1 (/*@null@*/ MY_OWN_TYPE **arg); you allow **arg to be NULL, but *arg still has to be non-NULL (unless **art is NULL, of course). In your case, you want initializeItem1() to _return_ *arg in **arg, so you should explain _this_ to splint: void initializeItem1 (/*@out@*/ MY_OWN_TYPE **arg); In this case, *arg may be NULL or even undefined. HTH, Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid@bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From lholzheid at bihl-wiedemann.de Wed Apr 18 16:21:28 2007 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Wed Apr 18 16:24:26 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: References: <4625D752.28160.25C714@wenzel.bbr-vt.de> Message-ID: <20070418202128.GB16498@svr5.bihl-wiedemann.de> On Wed, 2007-04-18 09:10:50 -0700, Keith Prickett wrote: > [..] > I am just not seeing where "listOfMyOwnType" may become null. > [..] Keith, 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: void initializeItem1 (/*@null@*/ MY_OWN_TYPE **arg); you allow **arg to be NULL, but *arg still has to be non-NULL (unless **art is NULL, of course). In your case, you want initializeItem1() to _return_ *arg in **arg, so you should explain _this_ to splint: void initializeItem1 (/*@out@*/ MY_OWN_TYPE **arg); In this case, *arg may be NULL or even undefined. HTH, Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid@bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From keithp at marvell.com Wed Apr 18 18:59:06 2007 From: keithp at marvell.com (Keith Prickett) Date: Wed Apr 18 18:59:16 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: <20070418202128.GB16498@svr5.bihl-wiedemann.de> References: <4625D752.28160.25C714@wenzel.bbr-vt.de> <20070418202128.GB16498@svr5.bihl-wiedemann.de> Message-ID: -----From: Ludolf Holzheid [mailto:lholzheid@bihl-wiedemann.de]----- Sent: Wednesday, April 18, 2007 1:21 PM To: splint-discuss@ares.cs.Virginia.EDU; 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 From keithp at marvell.com Wed Apr 18 18:59:06 2007 From: keithp at marvell.com (Keith Prickett) Date: Wed Apr 18 18:59:17 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: <20070418202128.GB16498@svr5.bihl-wiedemann.de> References: <4625D752.28160.25C714@wenzel.bbr-vt.de> <20070418202128.GB16498@svr5.bihl-wiedemann.de> Message-ID: -----From: Ludolf Holzheid [mailto:lholzheid@bihl-wiedemann.de]----- Sent: Wednesday, April 18, 2007 1:21 PM To: splint-discuss@ares.cs.Virginia.EDU; 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 From wenzel at bbr-vt.de Thu Apr 19 02:18:15 2007 From: wenzel at bbr-vt.de (Wenzel, Bodo) Date: Thu Apr 19 02:52:25 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error Message-ID: <462725C7.12683.12C9D0@wenzel.bbr-vt.de> Well, when I asked for your source, I ment to get a _complete_ example. If I use just the provided code snippet, there are several other warnings... test.c: (in function init) test.c(24,3): Unrecognized identifier: initializeItem1 Identifier used in code has not been declared. (Use -unrecog to inhibit warning) test.c(26,3): Unrecognized identifier: ASSERT test.c(29,3): Unrecognized identifier: useMyOwnList You don't want to waste my time letting me develop the missing stuff, do you? With regards, Bodo Wenzel - Software Development - -- BBR - Baudis Bergmann R?sch Verkehrstechnik GmbH Pillaustra?e 1e D - 38126 Braunschweig T: +49.531.27300-766 F: +49.531.27300-999 @: wenzel@bbr-vt.de W: http://www.bbr-vt.de Registergericht: AG Braunschweig HRB 3037 Gesch?ftsf?hrer: Dipl.-Ing. Arne Baudis Dipl.-Ing. Thomas Bergmann Dipl.-Ing. Frank-Michael R?sch USt.-ID-Nr.: DE 114 877 881 From keithp at marvell.com Thu Apr 19 13:25:29 2007 From: keithp at marvell.com (Keith Prickett) Date: Thu Apr 19 13:25:43 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: <462725C7.12683.12C9D0@wenzel.bbr-vt.de> References: <462725C7.12683.12C9D0@wenzel.bbr-vt.de> Message-ID: -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Wenzel, Bodo Sent: Wednesday, April 18, 2007 11:18 PM To: splint-discuss@cs.virginia.edu Subject: [splint-discuss] RE: Help on "Storage x may become null" error > Well, when I asked for your source, I ment to get a _complete_ example. If I use just the provided code snippet, there are several other warnings... Attached is a splint-compiling (with all default options on WIN32 i.e. "splint bla.c") example with the 1 error I am experiencing. Please let me know if the attachment doesn't come through as I haven't tried to attach an item to the list before. > You don't want to waste my time letting me develop the missing stuff, do you? Thanks for your help, sorry I didn't quite realize what you wanted. -- Keith Prickett -------------- next part -------------- A non-text attachment was scrubbed... Name: bla.c Type: application/octet-stream Size: 1228 bytes Desc: bla.c Url : http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20070419/acdc7b9a/bla.obj From wenzel at bbr-vt.de Fri Apr 20 03:29:54 2007 From: wenzel at bbr-vt.de (Wenzel, Bodo) Date: Fri Apr 20 03:30:04 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error Message-ID: <46288812.4031.55D469@wenzel.bbr-vt.de> Thanks! Please don't feel offended, but we better spend time to solve problems, not to fill gaps ;-) Your attachment was scrubbed from the digest I received, but there is a link to it. I'm sorry to reply so slowly, but my employer limits the time spend with non-profit stuff... These are my results and ideas: First, I ran splint with the contents shown below. To reduce the size, I have "condensed" the source a bit... As you reported, it complaints about "Null storage listOfMyOwnType[1] derivable from parameter", but on "initializeItem1 (&listOfMyOwnType[1])", not on useMyOwnList! It shows the correct row/column where "Storage listOfMyOwnType[1] becomes null." Second, I added "/*@out@*/" just before the parameter of the prototype of "initializeItem1", AFAIK there's no need to repeat it at the definition of the function. Now splint reports no warnings. Concerning the annotation for pointers to MY_OWN_TYPE; I think if you add "/*@null@*/" to listOfMyOwnType, it declares that symbol as possibly NULL. MY_OWN_TYPE*[] it is compatible to MY_OWN_TYPE**, and splint seems not to distinguish these. So, to annotate the elements, I suggest to "typedef /*@null@*/ MY_OWN_TYPE *MY_OWN_TYPE_POINTER;" and to declare "MY_OWN_TYPE_POINTER listOfMyOwnType[2];". Anyway, initializeItem1 needs the annotation at its parameter. You don't need to "return;" at the end of a "void" typed function. However, your coding convention might require this. To reduce the size of the exmaple source even more, the called function can be declared as global, and their definition omitted. BTW, my splint says "Splint 3.1.1 --- 12 April 2003" and it's running on Win2K. --- test*.c ------------------------------------------ typedef struct { int a; int b; char c; } MY_OWN_TYPE; static MY_OWN_TYPE gAType; static void initializeItem1( MY_OWN_TYPE ** ptrToItemInList ); static void useMyOwnList( MY_OWN_TYPE ** list ); void init( void ) { MY_OWN_TYPE * listOfMyOwnType[2]; listOfMyOwnType[0] = &gAType; listOfMyOwnType[1] = NULL; initializeItem1( &listOfMyOwnType[1] ); useMyOwnList( listOfMyOwnType ); } static void initializeItem1( MY_OWN_TYPE ** ptrToItemInList ) { static MY_OWN_TYPE item1; *ptrToItemInList = &item1; } static void useMyOwnList( MY_OWN_TYPE ** list ) { MY_OWN_TYPE * item; item = list[0]; } With regards, Bodo Wenzel - Software Development - -- BBR - Baudis Bergmann R?sch Verkehrstechnik GmbH Pillaustra?e 1e D - 38126 Braunschweig T: +49.531.27300-766 F: +49.531.27300-999 @: wenzel@bbr-vt.de W: http://www.bbr-vt.de Registergericht: AG Braunschweig HRB 3037 Gesch?ftsf?hrer: Dipl.-Ing. Arne Baudis Dipl.-Ing. Thomas Bergmann Dipl.-Ing. Frank-Michael R?sch USt.-ID-Nr.: DE 114 877 881 From lholzheid at bihl-wiedemann.de Fri Apr 20 14:07:47 2007 From: lholzheid at bihl-wiedemann.de (Ludolf Holzheid) Date: Fri Apr 20 14:08:08 2007 Subject: [splint-discuss] RE: Help on "Storage x may become null" error In-Reply-To: References: <4625D752.28160.25C714@wenzel.bbr-vt.de> <20070418202128.GB16498@svr5.bihl-wiedemann.de> <462725C7.12683.12C9D0@wenzel.bbr-vt.de> Message-ID: <20070420180747.GA29197@svr5.bihl-wiedemann.de> On Wed, 2007-04-18 15:59:06 -0700, Keith Prickett wrote: > [..] > This may be true, except splint contains about the line where an > assignment to listOfMyOwnType[0] is occuring. Hello Keith, If this is for the source you sent to Bodo Wenzel: You explicitly annotated listOfMyOwnType as being possibly NULL, so referencing it _must_ give a warning. As listOfMyOwnType[2] is of storage class "auto", it will be located on the stack and thus its address never will be NULL. I think you wanted to annotate the _elements_ of listOfMyOwnType. Bodo Wenzel provided a way to accomplish this by means of an intermediate type definition. > [..] > I can't get Splint to recognize my "ASSERT" (instead of using "ifs" like > above) but that's for a different topic. I don't know how your "ASSERT" is defined, so I can't say anything. The C99-macro "assert" (from ) seems to work, however. HTH, Ludolf -- --------------------------------------------------------------- Ludolf Holzheid Tel: +49 621 339960 Bihl+Wiedemann GmbH Fax: +49 621 3392239 Flo?w?rthstra?e 41 e-mail: lholzheid@bihl-wiedemann.de D-68199 Mannheim, Germany --------------------------------------------------------------- From mark at glines.org Mon Apr 23 23:54:10 2007 From: mark at glines.org (Mark Glines) Date: Mon Apr 23 23:56:57 2007 Subject: [splint-discuss] Preprocessor output? Message-ID: <20070423205410.2b9a6fa4@chirp> Hi, I am trying to run splint on the Parrot codebase (www.parrotcode.org), and having a difficult time of it. I have worked through several issues involving non-ANSI code and system header problems and so forth, but now I'm stuck. It would be very helpful to get access to the preprocessed source that splint is actually trying to parse. Is there a command line option which convinces splint to output its preprocessor output to stdout, or stderr or a log file or something? In other words, a splint equivalent of the gcc options '-E' and maybe '-dD' would be very helpful. Does such a thing exist? Thanks, Mark From mark at glines.org Mon Apr 23 23:54:10 2007 From: mark at glines.org (Mark Glines) Date: Tue Apr 24 00:17:25 2007 Subject: [splint-discuss] Preprocessor output? Message-ID: <20070423205410.2b9a6fa4@chirp> Hi, I am trying to run splint on the Parrot codebase (www.parrotcode.org), and having a difficult time of it. I have worked through several issues involving non-ANSI code and system header problems and so forth, but now I'm stuck. It would be very helpful to get access to the preprocessed source that splint is actually trying to parse. Is there a command line option which convinces splint to output its preprocessor output to stdout, or stderr or a log file or something? In other words, a splint equivalent of the gcc options '-E' and maybe '-dD' would be very helpful. Does such a thing exist? Thanks, Mark From brian.quinlan at iolfree.ie Tue Apr 24 05:08:17 2007 From: brian.quinlan at iolfree.ie (Brian Quinlan) Date: Tue Apr 24 05:27:50 2007 Subject: [splint-discuss] Preprocessor output? Message-ID: <462dc901.5c2.0@iolfree.ie> >It would be very helpful to get access to the preprocessed source that >splint is actually trying to parse. Is there a command line option >which convinces splint to output its preprocessor output to stdout, or >stderr or a log file or something? > >In other words, a splint equivalent of the gcc options '-E' and maybe >'-dD' would be very helpful. Does such a thing exist? > Hi Mark, Adding +keep to the splint command-line tells splint not to delete temporary files. The temporary files contain the preprocessor output. Bye, Brian *************************** ADVERTISEMENT ****************************** Get BT Broadband from only EUR20 per month! Always-on internet & wireless option - find out more at http://www.btireland.ie/broadband From evans at cs.virginia.edu Tue Apr 24 08:28:38 2007 From: evans at cs.virginia.edu (David Evans) Date: Tue Apr 24 08:29:43 2007 Subject: [splint-discuss] Preprocessor output? In-Reply-To: <20070423205410.2b9a6fa4@chirp> References: <20070423205410.2b9a6fa4@chirp> Message-ID: <462DF7F6.7010607@cs.virginia.edu> Hi Mark, Mark Glines wrote: > It would be very helpful to get access to the preprocessed source that > splint is actually trying to parse. Is there a command line option > which convinces splint to output its preprocessor output to stdout, or > stderr or a log file or something? If you use the -keep option, splint will keep the temporary (post-pre-processor) files and print out a list of their file names at the end of the run. --- Dave From mark at glines.org Tue Apr 24 11:42:52 2007 From: mark at glines.org (Mark Glines) Date: Tue Apr 24 11:43:05 2007 Subject: [splint-discuss] Information cached between source files? In-Reply-To: <462DF7F6.7010607@cs.virginia.edu> References: <20070423205410.2b9a6fa4@chirp> <462DF7F6.7010607@cs.virginia.edu> Message-ID: <20070424084252.52a423df@chirp> David, Brian, thanks for your help. That's exactly what I needed. On to the next problem... :) I am running into a problem where specifying multiple source files on the command line affects the preprocessor parsing those files. Hmm, that sentence didn't make a lot of sense. Let me try an example: File 1 (compilers/imcc/cfg.c) parses fine, when I run splint on it alone. File 2 (compilers/imcc/debug.c) parses fine, when I run splint on it alone. But if I put both filenames on the same splint command-line, the second file gets a parse error. Upon further investigation of the preprocessor output, it seems that an important header-file didn't get included for the second file, causing a parse error when using a typedef (__sighandler_t) which never actually got typedeffed. Is this expected behavior? Is it a bug? If I add a "+single-includes" to the command-line, the above problem goes away. But this flag breaks another source file down the line, which expects different headerfile behavior due to having some extra macro defined. So I'm trying to understand exactly what +single-includes does. Here's my current splint command-line: splint +keep -I./include -DHAS_JIT -DI386 "-Isrc/pmc" "-Icompilers/ast" -weak +showscan +showsummary -warnposixheaders -abstract +aliasunique +ansireserved +ansireservedinternal +assignexpose +bitwisesigned +boolcompare +booltype BOOLVAL -castfcnptr -charint +continuecomment +controlnestdepth 15 +cppnames +declundef +distinctinternalnames +evalorder +fielduse +forcehints -globs +imptype +includenest 20 +incondefs +incondefslib +linelen 9999 +longintegral +macroassign +macroempty +macroredef +matchanyintegral +nestedextern +noeffect +readonlystrings +realcompare +shadow -type -isoreserved -isoreservedinternal +single-includes ... followed by a couple hundred source filenames. I guess my problem is that this source tree will not work with +single-includes, without significant refactoring of the header files... But it seems to be required for specifying multiple C sources on the same command-line. Any other ideas for things I can try? Is there any alternative to breaking things up so splint runs once for each source file? Thanks, Mark