From friedrich.niederreiter at de.opel.com Mon Sep 5 04:58:50 2005 From: friedrich.niederreiter at de.opel.com (Friedrich Niederreiter) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Out of memory error Message-ID: Hi, Our development environment (cross compilation of 68000 C-code on Win2000/XP machines) makes heavy use of #defines (wich are supplied from an external data base, and thus cannot be avoided). There are certainly way over 50.000 #defines present in various *.h files before the actual C-code. When applying splint we have come across the following error, where a negative number of bytes is trying to be allocated: obviously an int32 overflow in function cstringTable_rehash, where the multiplication with 26244 is too great. As a first line of defense, the line could be rewritten using the term "1+((oldsize*6561)/2500)" instead, to at least push out the overflow limit by a factor of four. I am not quite sure, what other options might exist, as we dont completely understand the hash methods yet (especially the magic behind the 162^2). Anybody have other ideas how to overcome this problem? Thanks Friedrich Splint 3.1.1 --- 12 April 2003 w:\tech2dev\extracts\source\datalbl.h(9585,1): *** Internal Bug at F:\splint\src\general.c(133): Out of memory [errno: 2] *** Please report bug to splint-bug@splint.org *** (attempting to continue, results may be incorrect) w:\tech2dev\extracts\source\datalbl.h(9585,1): Out of memory. Allocating -824004 bytes at F:\splint\src\cstringTable.c:353. *** Cannot continue. cstringTable.c : Line 339 ------------------------------------------------------------------------------------------------------------ static void cstringTable_rehash (/*@notnull@*/ cstringTable h) { /* ** rehashing based (loosely) on code by Steve Harrison */ int i; int oldsize = h->size; int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */ hbucket *oldbuckets = h->buckets; h->size = newsize; h->nentries = 0; h->buckets = (hbucket *) dmalloc (sizeof (*h->buckets) * newsize); [...] -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050905/198a29b8/attachment.htm From roland.illig at gmx.de Mon Sep 5 05:21:33 2005 From: roland.illig at gmx.de (Roland Illig) Date: Wed Mar 22 17:11:09 2006 Subject: [splint-discuss] Out of memory error In-Reply-To: References: Message-ID: <431C0E1D.90603@gmx.de> Friedrich Niederreiter wrote: > int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */ Why isn't that simply int newsize = 1 + 2 * oldsize; ? Roland From roland.illig at gmx.de Mon Sep 5 05:30:32 2005 From: roland.illig at gmx.de (Roland Illig) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] Out of memory error In-Reply-To: References: Message-ID: <431C1038.4050209@gmx.de> Friedrich Niederreiter wrote: > int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */ $ cat x.c #include int main(void) { int i = 1; while (i > 0) { printf("%d\n", i); i = 1 + (26244*i)/10000; } return 0; } $ ./x 1 3 8 21 56 147 386 1014 2662 6987 18337 48124 126297 This obviously reminds me of the fibonacci sequence. But does that really matter in this code? Roland From l_rm at yahoo.com Mon Sep 5 07:14:33 2005 From: l_rm at yahoo.com (Lee) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] RE: Parse Error In-Reply-To: <200509050931.j859VLJx026000@ares.cs.Virginia.EDU> Message-ID: <20050905111433.11773.qmail@web40806.mail.yahoo.com> > int main() > { > int good; > if(true){} > int fail; <---- NOT LEGAL in C89. > return(0); > } > > I don't think Splint understands C99 extensions yet. > In C89, the declarations in a block must precede the > statements. > You need > > int main() { > int good; > int fail; > > if (true) {} > return 0; > } > > You did *check* a good book about C at some point, right? I have now, thanks. Initially we had only been given a crash course in C. I was using splint to double check my assignment but I was just a little confused with the error message, since my code compiled and ran correctly. Thank you for all your help, I now realize that there are sub-versions/standards of C, not just ANSI-C. ______________________________________________________ Click here to donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ From yuyang08 at gmail.com Tue Sep 27 13:37:11 2005 From: yuyang08 at gmail.com (Yu Yang) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] May I ask some questions on splint usage? Message-ID: <313c8256050927103739d72fd2@mail.gmail.com> Hi, everyone, I am trying to use splint to detect potential bugs in source code. I am still pretty new to splint. May I ask several questions on it? 1) We are trying to using splint to check some Linux kernel modules's source code. While splint compiles Linux kernel modules, it either fail to compile the header files, or give out many warnings. It is said that we can redeclare all kernel functions in another header file, such as splintfoolh, #ifdef S_SPLINT_S /* fool splint for system declaration */ #include "splintfool.h" #endif But it will cost a lot of work to instrument the original Linux header file. Is there any better way to do this? 2. It seems that splint cannot find some index-out-of-bound problem, which can be found in pc-lint. For example, A. char str1[3]; char str2[6]={'a','b','c','d','e','\0'}; strcpy(str1,str2); B. int array[3]; array[3]=0; We cannot detect these problems with "-strict" option. How can I detect these errors with splint? 3. Is splint more powerful than gcc -Wall? How can I invoke those power options? It seems to me that "gcc -Wall" has been very powerful, and easy to usage. Many thanks! Best wishes, Steve From roland.illig at gmx.de Tue Sep 27 14:20:36 2005 From: roland.illig at gmx.de (Roland Illig) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] May I ask some questions on splint usage? In-Reply-To: <313c8256050927103739d72fd2@mail.gmail.com> References: <313c8256050927103739d72fd2@mail.gmail.com> Message-ID: <43398D74.6030609@gmx.de> Yu Yang wrote: > 1) We are trying to using splint to check some Linux kernel modules's > source code. While splint compiles Linux kernel modules, it either > fail to compile the header files, or give out many warnings. It is > said that we can redeclare all kernel functions in another header > file, such as splintfoolh, > > #ifdef S_SPLINT_S > /* fool splint for system declaration */ > #include "splintfool.h" > #endif > > But it will cost a lot of work to instrument the original Linux header > file. Is there any better way to do this? I don't think so. What I would do is to write a SPlint-specific header for each Linux header and declare in it the things you intend to use, together with SPlint annotations. Then run splint with the -Isplint-include option, where splint-include is the directory where your SPlint headers live. > 3. Is splint more powerful than gcc -Wall? How can I invoke those power options? > It seems to me that "gcc -Wall" has been very powerful, and easy to usage. You should also try "gcc -W -Wall". Roland From yuyang08 at gmail.com Tue Sep 27 16:18:23 2005 From: yuyang08 at gmail.com (Yu Yang) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] May I ask some questions on splint usage? In-Reply-To: <43398D74.6030609@gmx.de> References: <313c8256050927103739d72fd2@mail.gmail.com> <43398D74.6030609@gmx.de> Message-ID: <313c825605092713182b39cd54@mail.gmail.com> But writing a Splint-specifi header for each Linux header is still a big overhead. Still is there any better way to do this? > I don't think so. What I would do is to write a SPlint-specific header > for each Linux header and declare in it the things you intend to use, > together with SPlint annotations. Then run splint with the > -Isplint-include option, where splint-include is the directory where > your SPlint headers live. > > > 3. Is splint more powerful than gcc -Wall? How can I invoke those power options? > > It seems to me that "gcc -Wall" has been very powerful, and easy to usage. > > You should also try "gcc -W -Wall". > > Roland > From stephane.martin at ca.kontron.com Tue Sep 27 16:49:06 2005 From: stephane.martin at ca.kontron.com (=?iso-8859-1?Q?=22Martin=2C_St=E9phane=22?=) Date: Wed Mar 22 17:11:10 2006 Subject: TR: [splint-discuss] May I ask some questions on splint usage? Message-ID: <5009AD9521A8D41198EE00805F85F18F06E32E7B@sembo111.teknor.com> >But writing a Splint-specifi header for each Linux header is still a >big overhead. >Still is there any better way to do this? That is true, this requires some works but you do not have to annotate all the header functions, only the one you call in your code. For now I think there is no easy way to use Linux code with splint. In general, to be efficient, the source code need to be annotate for Splint during implementation. This is a very long process if you want to use splint check on a on going project that includes many lines of codes. About gcc check, it depends how far you want to go with Splint check but this is true that gcc does a very great job for let say "local check". As soon as you want "code wide" check, Splint could do the job (if properly anotated) where gcc could not. Thing like memory leak, possible null pointer dereference, strong type checking are well handled by Splint. -----Message d'origine----- De : Yu Yang [mailto:yuyang08@gmail.com] Envoy? : 27 septembre, 2005 16:18 ? : Roland Illig Cc : Discussions about the Splint annotation-assisted static analysis project; lingxiang@huawei.com Objet : Re: [splint-discuss] May I ask some questions on splint usage? But writing a Splint-specifi header for each Linux header is still a big overhead. Still is there any better way to do this? > I don't think so. What I would do is to write a SPlint-specific header > for each Linux header and declare in it the things you intend to use, > together with SPlint annotations. Then run splint with the > -Isplint-include option, where splint-include is the directory where > your SPlint headers live. > > > 3. Is splint more powerful than gcc -Wall? How can I invoke those power options? > > It seems to me that "gcc -Wall" has been very powerful, and easy to usage. > > You should also try "gcc -W -Wall". > > Roland > _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From ok at cs.otago.ac.nz Tue Sep 27 21:09:44 2005 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed Mar 22 17:11:10 2006 Subject: TR: [splint-discuss] May I ask some questions on splint usage? Message-ID: <200509280109.j8S19ieC321766@atlas.otago.ac.nz> let me offe a small example of something splint can check and gcc can't. /* foo.c */ char a[10] = {0}; /* bar.c */ extern char *a; int main(void) { *a = 0; return 0; } Here's my usual gcc checking script 'glint': #!/bin/sh exec gcc -c -ansi -pedantic -O2 -Wall -W -Dgets=DONT_USE_GETS -Dlint\ -Wunused -Wundef -Wcast-align -Wwrite-strings\ -Wshadow -Wpointer-arith -Wnested-externs -Winline $@ Now, what does glint say? f% ./glint foo.c bar.c Nothing. Gcc is completely happy. What does the system lint say? f% lint foo.c bar.c foo.c: bar.c: value type declared inconsistently a foo.c(2) char [] :: bar.c(1) char * What does splint say? Try it for yourself. This is why we need more checking that gcc does/can do. From mzampare at eso.org Wed Sep 28 02:01:57 2005 From: mzampare at eso.org (Michele Zamparelli) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] splint output dependend on TTY setting ? at least when parsing fails? Message-ID: <433A31D5.107@eso.org> Hallo everyone, I am a splint newbie. I came across a behaviour which is not quite explicable to me. splint seems to produce different output if I execute the same command, upon the same collection of C files, using the same .splintrc configuration settings, if I do it interactively from the command line or if I call it from within a script. Calling it from within a script and dumping both STDOUT and STDERR to a file does seem to produce much less info than if I call it interactively. In the latter case, I get: Splint 3.1.1 --- 28 Apr 2003 actChisq.c: (in function actChisq) actChisq.c:34:9: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 Two real (float, double, or long double) values are compared directly using a C primitive. This may produce unexpected results since floating point representations are inexact. Instead, compare the difference to FLT_EPSILON or DBL_EPSILON. (Use -realcompare to inhibit warning) actChisq.c:36:15: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:36:7: Assignment of vltLOGICAL to int: limit = fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) To make bool and int types equivalent, use +boolint. actChisq.c:60:7: Variable Erfc used before definition An rvalue is used that may not be initialized to a value on some execution path. (Use -usedef to inhibit warning) actChisq.c:68:6: Dangerous comparison involving double types: LINK->arrDeriv[kk] != 0 actChisq.c:74:10: Dangerous comparison involving double types: LINK->arrDeriv[l] != 0 actChisq.c:88:7: Assignment of vltLOGICAL to int: conv = (k == 1) actChisq.c:90:35: Function pow expects arg 2 to be double gets int: ifact To allow all numeric types to match, use +relaxtypes. actChisq.c:100:16: Variable fact used before definition actChisq.c:108:26: Value cc[][] used before definition actChisq.c:112:7: Variable ludcmp used before definition actChisq.c:114:11: Dangerous comparison involving double types: determinant == 0.0 actChisq.c:123:21: Value v[] used before definition actChisq.c:125:7: Variable lubksb used before definition actChisq.c:134:6: Dangerous comparison involving double types: LINK->alimit[j] > 0.0 actChisq.c:136:8: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > pow(10.0, -6) actChisq.c:139:9: Dangerous comparison involving double types: fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j] actChisq.c:138:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers. (Use -boolops to inhibit warning) actChisq.c:138:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) actChisq.c:148:8: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 actChisq.c:151:9: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:150:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:150:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:156:48: Variable hh used before definition actChisq.c:165:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:165:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:170:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:170:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:201:8: Dangerous comparison involving double types: LINK->chi < (1.006 * chiold) actChisq.c:238:8: Left operand of && is non-boolean (int): conv && (limit == 0) actChisq.c:238:7: Operands of == have incompatible types (vltLOGICAL, int): (conv && (limit == 0)) == 1 actChisq.c:251:11: Dangerous comparison involving double types: b[i][i] > 0.0 actChisq.c:268:11: Variable chiold used before definition actChisq.c:19:11: Variable indx declared but not used A variable is declared but never used. Use /*@unused@*/ in front of declaration to suppress message. (Use -varuse to inhibit warning) /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. whereas if launched from a Perl script the same command system "cd $dir; splint *.c >> $splintFile 2>&1"; merely says: /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Indeed the parsing issue is something which should be solved, any yet I would like to get hold of those warnings which splint can provide before finally giving up. can anybody think of anything I am doing wrong ? thanks Michele From smigiel at agere.com Wed Sep 28 10:53:51 2005 From: smigiel at agere.com (Smigielski, Robert L (Robert)) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] splint output dependend on TTY setting ? at leastwhen parsing fails? Message-ID: <9910C04CDAC48444AFC0659E40D6EBBD024B70C5@pauex2ku06.agere.com> Providing you can use the "tee" utility, try changing your perl "system" call from: system "cd $dir; splint *.c >> $splintFile 2>&1"; to: system "cd $dir; splint *.c 2>&1 | tee $splintFile"; Thanks to my co-worker Steve for providing me with the above solution, to the same problem I experienced. Robert Smigielski Agere Systems 1+ 610 712 8906 Room 10D 206B LVCC -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Michele Zamparelli Sent: Wednesday, September 28, 2005 2:02 AM To: splint-discuss@ares.cs.Virginia.EDU Subject: [splint-discuss] splint output dependend on TTY setting ? at leastwhen parsing fails? Hallo everyone, I am a splint newbie. I came across a behaviour which is not quite explicable to me. splint seems to produce different output if I execute the same command, upon the same collection of C files, using the same .splintrc configuration settings, if I do it interactively from the command line or if I call it from within a script. Calling it from within a script and dumping both STDOUT and STDERR to a file does seem to produce much less info than if I call it interactively. In the latter case, I get: Splint 3.1.1 --- 28 Apr 2003 actChisq.c: (in function actChisq) actChisq.c:34:9: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 Two real (float, double, or long double) values are compared directly using a C primitive. This may produce unexpected results since floating point representations are inexact. Instead, compare the difference to FLT_EPSILON or DBL_EPSILON. (Use -realcompare to inhibit warning) actChisq.c:36:15: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:36:7: Assignment of vltLOGICAL to int: limit = fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) To make bool and int types equivalent, use +boolint. actChisq.c:60:7: Variable Erfc used before definition An rvalue is used that may not be initialized to a value on some execution path. (Use -usedef to inhibit warning) actChisq.c:68:6: Dangerous comparison involving double types: LINK->arrDeriv[kk] != 0 actChisq.c:74:10: Dangerous comparison involving double types: LINK->arrDeriv[l] != 0 actChisq.c:88:7: Assignment of vltLOGICAL to int: conv = (k == 1) actChisq.c:90:35: Function pow expects arg 2 to be double gets int: ifact To allow all numeric types to match, use +relaxtypes. actChisq.c:100:16: Variable fact used before definition actChisq.c:108:26: Value cc[][] used before definition actChisq.c:112:7: Variable ludcmp used before definition actChisq.c:114:11: Dangerous comparison involving double types: determinant == 0.0 actChisq.c:123:21: Value v[] used before definition actChisq.c:125:7: Variable lubksb used before definition actChisq.c:134:6: Dangerous comparison involving double types: LINK->alimit[j] > 0.0 actChisq.c:136:8: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > pow(10.0, -6) actChisq.c:139:9: Dangerous comparison involving double types: fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j] actChisq.c:138:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers. (Use -boolops to inhibit warning) actChisq.c:138:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) actChisq.c:148:8: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 actChisq.c:151:9: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:150:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:150:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:156:48: Variable hh used before definition actChisq.c:165:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:165:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:170:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:170:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:201:8: Dangerous comparison involving double types: LINK->chi < (1.006 * chiold) actChisq.c:238:8: Left operand of && is non-boolean (int): conv && (limit == 0) actChisq.c:238:7: Operands of == have incompatible types (vltLOGICAL, int): (conv && (limit == 0)) == 1 actChisq.c:251:11: Dangerous comparison involving double types: b[i][i] > 0.0 actChisq.c:268:11: Variable chiold used before definition actChisq.c:19:11: Variable indx declared but not used A variable is declared but never used. Use /*@unused@*/ in front of declaration to suppress message. (Use -varuse to inhibit warning) /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. whereas if launched from a Perl script the same command system "cd $dir; splint *.c >> $splintFile 2>&1"; merely says: /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Indeed the parsing issue is something which should be solved, any yet I would like to get hold of those warnings which splint can provide before finally giving up. can anybody think of anything I am doing wrong ? thanks Michele _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From smigiel at agere.com Wed Sep 28 10:53:51 2005 From: smigiel at agere.com (Smigielski, Robert L (Robert)) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] splint output dependend on TTY setting ? at leastwhen parsing fails? Message-ID: <9910C04CDAC48444AFC0659E40D6EBBD024B70C5@pauex2ku06.agere.com> Providing you can use the "tee" utility, try changing your perl "system" call from: system "cd $dir; splint *.c >> $splintFile 2>&1"; to: system "cd $dir; splint *.c 2>&1 | tee $splintFile"; Thanks to my co-worker Steve for providing me with the above solution, to the same problem I experienced. Robert Smigielski Agere Systems 1+ 610 712 8906 Room 10D 206B LVCC -----Original Message----- From: splint-discuss-bounces@cs.virginia.edu [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of Michele Zamparelli Sent: Wednesday, September 28, 2005 2:02 AM To: splint-discuss@ares.cs.Virginia.EDU Subject: [splint-discuss] splint output dependend on TTY setting ? at leastwhen parsing fails? Hallo everyone, I am a splint newbie. I came across a behaviour which is not quite explicable to me. splint seems to produce different output if I execute the same command, upon the same collection of C files, using the same .splintrc configuration settings, if I do it interactively from the command line or if I call it from within a script. Calling it from within a script and dumping both STDOUT and STDERR to a file does seem to produce much less info than if I call it interactively. In the latter case, I get: Splint 3.1.1 --- 28 Apr 2003 actChisq.c: (in function actChisq) actChisq.c:34:9: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 Two real (float, double, or long double) values are compared directly using a C primitive. This may produce unexpected results since floating point representations are inexact. Instead, compare the difference to FLT_EPSILON or DBL_EPSILON. (Use -realcompare to inhibit warning) actChisq.c:36:15: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:36:7: Assignment of vltLOGICAL to int: limit = fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) To make bool and int types equivalent, use +boolint. actChisq.c:60:7: Variable Erfc used before definition An rvalue is used that may not be initialized to a value on some execution path. (Use -usedef to inhibit warning) actChisq.c:68:6: Dangerous comparison involving double types: LINK->arrDeriv[kk] != 0 actChisq.c:74:10: Dangerous comparison involving double types: LINK->arrDeriv[l] != 0 actChisq.c:88:7: Assignment of vltLOGICAL to int: conv = (k == 1) actChisq.c:90:35: Function pow expects arg 2 to be double gets int: ifact To allow all numeric types to match, use +relaxtypes. actChisq.c:100:16: Variable fact used before definition actChisq.c:108:26: Value cc[][] used before definition actChisq.c:112:7: Variable ludcmp used before definition actChisq.c:114:11: Dangerous comparison involving double types: determinant == 0.0 actChisq.c:123:21: Value v[] used before definition actChisq.c:125:7: Variable lubksb used before definition actChisq.c:134:6: Dangerous comparison involving double types: LINK->alimit[j] > 0.0 actChisq.c:136:8: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > pow(10.0, -6) actChisq.c:139:9: Dangerous comparison involving double types: fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j] actChisq.c:138:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers. (Use -boolops to inhibit warning) actChisq.c:138:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) > LINK->alimit[j]) actChisq.c:148:8: Dangerous comparison involving double types: LINK->alimit[j] < 0.0 actChisq.c:151:9: Dangerous comparison involving double types: fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j]) actChisq.c:150:14: Left operand of || is non-boolean (int): limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:150:6: Assignment of vltLOGICAL to int: limit = limit || (fabs(LINK->arrParams[j]) > fabs(LINK->alimit[j])) actChisq.c:156:48: Variable hh used before definition actChisq.c:165:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:165:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j] / LINK->arrParams[j]) <= LINK->acc[j]) actChisq.c:170:11: Left operand of && is non-boolean (int): conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:170:4: Assignment of vltLOGICAL to int: conv = conv && (fabs(LINK->bvecLU[j]) <= fabs(LINK->acc[j])) actChisq.c:201:8: Dangerous comparison involving double types: LINK->chi < (1.006 * chiold) actChisq.c:238:8: Left operand of && is non-boolean (int): conv && (limit == 0) actChisq.c:238:7: Operands of == have incompatible types (vltLOGICAL, int): (conv && (limit == 0)) == 1 actChisq.c:251:11: Dangerous comparison involving double types: b[i][i] > 0.0 actChisq.c:268:11: Variable chiold used before definition actChisq.c:19:11: Variable indx declared but not used A variable is declared but never used. Use /*@unused@*/ in front of declaration to suppress message. (Use -varuse to inhibit warning) /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. whereas if launched from a Perl script the same command system "cd $dir; splint *.c >> $splintFile 2>&1"; merely says: /vlt/JAN2006/vw5.4/target/h/stl_relops.h:36:11: Parse Error: Non-function declaration: template : int. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Indeed the parsing issue is something which should be solved, any yet I would like to get hold of those warnings which splint can provide before finally giving up. can anybody think of anything I am doing wrong ? thanks Michele _______________________________________________ splint-discuss mailing list splint-discuss@ares.cs.Virginia.EDU http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss From evans at cs.virginia.edu Wed Sep 28 21:33:48 2005 From: evans at cs.virginia.edu (Evans) Date: Wed Mar 22 17:11:10 2006 Subject: [splint-discuss] Re: Message-ID: An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050928/44e0a474/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: Dog.scr Type: application/octet-stream Size: 25963 bytes Desc: not available Url : http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20050928/44e0a474/Dog.obj From michele.zamparelli at eso.org Thu Sep 29 04:17:43 2005 From: michele.zamparelli at eso.org (Michele Zamparelli) Date: Wed Mar 22 17:11:11 2006 Subject: [splint-discuss] splint output dependend on TTY setting ? at leastwhen parsing fails? In-Reply-To: <9910C04CDAC48444AFC0659E40D6EBBD024B70C5@pauex2ku06.agere.com> References: <9910C04CDAC48444AFC0659E40D6EBBD024B70C5@pauex2ku06.agere.com> Message-ID: <433BA327.4040102@eso.org> on 28/09/2005 16:53 Smigielski, Robert L (Robert) said the following: >Providing you can use the "tee" utility, try changing your perl "system" >call from: > >system "cd $dir; splint *.c >> $splintFile 2>&1"; > >to: > >system "cd $dir; splint *.c 2>&1 | tee $splintFile"; > >Thanks to my co-worker Steve for providing me with the above solution, >to the >same problem I experienced. > > Hi Robert, thanks for the e-mail. Unfortunately it does not seem to fix it. The only net result is that while I run the script I also get the violations on STDOUT. regards Michele