From arosas at fisica.ufpb.br Fri Dec 16 16:06:00 2005 From: arosas at fisica.ufpb.br (arosas@fisica.ufpb.br) Date: Wed Mar 22 17:11:19 2006 Subject: [splint-discuss] newbie question Message-ID: <33860.200.165.87.180.1134767160.squirrel@200.165.87.180> Hi All, I've just started using splint and I need some help. I want to split my code in two files and define a global pointer. What is more, I want to allocate memory in one file and free it in the other. For example, /* First File */ #include #include int *ptr; void inicial(); main() { inicial(); printf("%d\n", ptr[5]); free(ptr); return 1; } /* Second File */ #include #include extern int *ptr; void inicial() { if((ptr = (int *)malloc(10*sizeof(int)))==NULL) { printf("cannot allocate memory\n"); exit(EXIT_FAILURE); } ptr[5] = 1; } When I splint them togheter I get warnings about "Unqualified storage ptr passed as only param: free (ptr)", "Function returns with global ptr referencing released storage" and "Function returns with global ptr not completely defined". >From the messages, I could figure out that using the options "-unqualifiedtrans -globstate" the warnings disappeared, however, in this case, splint just do not check if I'm really freeing the memory somewhere else. In there any way to splint clean code and make splint check for memory leak? Thanks. Alexandre From ai2097 at yahoo.com Fri Dec 16 23:37:58 2005 From: ai2097 at yahoo.com (Quandary) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] Maintenance status? Message-ID: <20051217043758.62670.qmail@web51709.mail.yahoo.com> Hey all, I'm wondering if splint is still actively maintained or not. I've sent mail to info at splint dot org, as well as to this list (via the moderator). I've gotten no response to either mail, and the latter never got approved or rejected, from what I can tell. Furthermore, the anonymous CVS claims to be at version 3.1.0 (instead of 3.1.1), and all of the systems (bug tracker, patch tracker, et. al.) are empty on the SourceForge side of things. So... I'm starting to wonder who, if anyone, is holding all of this together? Static analysis is great for giving code the once-over, and splint does a more or less decent (if not somewhat cryptic) job of adding semantic intent to C code to improve checking ability. I currently have a little patchset sitting on my disk that gets rid of the irritating compile warnings when compiling with moderate CFLAGS ("-Wall -posix -std=c99 -pedantic"), and I don't know where to send it to. Also, I'm a bit worried as I look over the code, because at least one file (src/Headers/splintMacros.nf) appears to be under a GPL-incompatible license. Anyone able to point me to the person(s) "in charge"? Or at least tell me where I can send my patches ;)? -- Travis __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From evans at cs.virginia.edu Sat Dec 17 14:24:52 2005 From: evans at cs.virginia.edu (David Evans) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] Maintenance status? In-Reply-To: <20051217043758.62670.qmail@web51709.mail.yahoo.com> References: <20051217043758.62670.qmail@web51709.mail.yahoo.com> Message-ID: Hi Travis, Splint is not currently actively maintained, although I occasionally find time to fix important bugs or incorporate non-disruptive patches. The license is here: http://www.splint.org/license.html Some of the header files have old more draconian copyright information, but the GPL applies to all the Splint code. Please feel free to make whatever changes you want. If you publically distribute an improved version, I would appreciate knowing about it, but you don't need permission as long as the GPL is followed. Regards, --- Dave On Fri, 16 Dec 2005, Quandary wrote: > Hey all, > > I'm wondering if splint is still actively maintained > or not. I've sent mail to info at splint dot org, as > well as to this list (via the moderator). I've gotten > no response to either mail, and the latter never got > approved or rejected, from what I can tell. > Furthermore, the anonymous CVS claims to be at version > 3.1.0 (instead of 3.1.1), and all of the systems (bug > tracker, patch tracker, et. al.) are empty on the > SourceForge side of things. > > So... I'm starting to wonder who, if anyone, is > holding all of this together? Static analysis is great > for giving code the once-over, and splint does a more > or less decent (if not somewhat cryptic) job of adding > semantic intent to C code to improve checking ability. > I currently have a little patchset sitting on my disk > that gets rid of the irritating compile warnings when > compiling with moderate CFLAGS ("-Wall -posix -std=c99 > -pedantic"), and I don't know where to send it to. > Also, I'm a bit worried as I look over the code, > because at least one file > (src/Headers/splintMacros.nf) appears to be under a > GPL-incompatible license. > > > Anyone able to point me to the person(s) "in charge"? > Or at least tell me where I can send my patches ;)? > > > -- Travis > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > 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 Sat Dec 17 16:10:57 2005 From: Michael.Wojcik at MicroFocus.com (Michael Wojcik) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] newbie question Message-ID: <11352F9641010A418AD5057945A3A6591F12DA@MTV-EXCHANGE.microfocus.com> > From: splint-discuss-bounces@cs.virginia.edu > [mailto:splint-discuss-bounces@cs.virginia.edu] On Behalf Of > arosas@fisica.ufpb.br > Sent: Friday, 16 December, 2005 16:06 > > I want to split my code in two files and define > a global pointer. What is more, I want to allocate > memory in one file and free it in the other. For example, > > /* First File */ > #include > #include > > int *ptr; > void inicial(); > main() > { > inicial(); > printf("%d\n", ptr[5]); > free(ptr); > return 1; > } > > /* Second File */ > #include > #include > > extern int *ptr; > void > inicial() > { > if((ptr = (int *)malloc(10*sizeof(int)))==NULL) In C, the result of malloc (and calloc and realloc) should not be cast. (In C++, it often needs to be; but in C++ it's rarely advisable to use malloc et al.) And this code assumes the type of ptr rather than letting the compiler supply it. Try: if ((ptr = malloc(10 * sizeof *ptr)) == NULL) > { > printf("cannot allocate memory\n"); > exit(EXIT_FAILURE); > } > ptr[5] = 1; > } > > When I splint them togheter I get warnings about "Unqualified > storage ptr passed as only param: free (ptr)", I'm not sure what Splint is going on about here. As happens far too often, the documentation is insufficient. It appears that Splint uses the term "qualified" to refer to the presence of type-qualifiers (const, volatile, and restrict) and sc-specifiers (auto, static, and register) in a variable's declaration. It's true that "ptr" is "unqualified" by that definition, but why passing such a pointer "as only param" is an issue is unclear to me. > "Function returns with global ptr referencing released storage" main does, indeed, return with a global ptr (ptr) that refers to freed memory. Setting ptr to null after the free call ought to suppress this warning. (In the case of this simple program, nothing will ever evaluate ptr after main returns, but that's not the case in general: main could be called recursively, in which case returning from it does not necessarily end the program, or there could be registered exit functions that evaluate ptr.) > and "Function returns with global ptr not completely defined". In Splint, "completely defined" means all elements of an object have been assigned a value. inicial allocates the memory pointed to by ptr, then initializes only ptr[5]; that means the object is not completely defined. You should be able to suppress this warning by assigning to all elements of the memory pointed to by ptr, before returning from inicial. -- Michael Wojcik Principal Software Systems Developer, Micro Focus From raeburn at raeburn.org Sat Dec 17 16:55:32 2005 From: raeburn at raeburn.org (Ken Raeburn) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] newbie question In-Reply-To: <11352F9641010A418AD5057945A3A6591F12DA@MTV-EXCHANGE.microfocus.com> References: <11352F9641010A418AD5057945A3A6591F12DA@MTV-EXCHANGE.microfocus.com> Message-ID: <0B7A9D2C-6BC3-4541-ADFE-7B659EBD3CBB@raeburn.org> On Dec 17, 2005, at 16:10, Michael Wojcik wrote: > I'm not sure what Splint is going on about here. As happens far too > often, the documentation is insufficient. It appears that Splint uses > the term "qualified" to refer to the presence of type-qualifiers > (const, > volatile, and restrict) and sc-specifiers (auto, static, and register) > in a variable's declaration. It's true that "ptr" is "unqualified" by > that definition, but why passing such a pointer "as only param" is an > issue is unclear to me. Remember that "only" is one of the Splint annotations. (Perhaps it should be quoted or uppercase, to make it clearer that it's not just ordinary English usage?) At first glance, I'd guess it may be a way of complaining that there's still another reference (in the global variable) to that storage, and "unqualified" isn't important here. Or maybe "unqualified" in this case means it doesn't have an annotation? Like you say, the documentation (and diagnostics) could be clearer.... Ken From rw at shadow.org.uk Sun Dec 18 10:32:31 2005 From: rw at shadow.org.uk (Rich Walker) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] Re: Maintenance status? In-Reply-To: (David Evans's message of "Sat, 17 Dec 2005 14:24:52 -0500 (EST)") References: <20051217043758.62670.qmail@web51709.mail.yahoo.com> Message-ID: David Evans writes: > Hi Travis, > > Splint is not currently actively maintained, although I occasionally find time to fix important bugs > or incorporate non-disruptive patches. > > The license is here: > http://www.splint.org/license.html > Some of the header files have old more draconian copyright > information, but the GPL applies to all the Splint code. Please feel > free to make whatever changes you want. If you publically distribute > an improved version, I would appreciate knowing about it, but you > don't need permission as long as the GPL is followed. Would it make sense to add someone else to the SourceForge project so they could do releases as necessary? cheers, Rich. -- rich walker | Shadow Robot Company | rw@shadow.org.uk technical director 251 Liverpool Road | need a Hand? London N1 1LX | +UK 20 7700 2487 www.shadow.org.uk/products/newhand.shtml From evans at cs.virginia.edu Sun Dec 18 12:49:16 2005 From: evans at cs.virginia.edu (David Evans) Date: Wed Mar 22 17:11:20 2006 Subject: [splint-discuss] Re: Maintenance status? In-Reply-To: References: <20051217043758.62670.qmail@web51709.mail.yahoo.com> Message-ID: On Sun, 18 Dec 2005, Rich Walker wrote: > ... > Would it make sense to add someone else to the SourceForge project so > they could do releases as necessary? > > cheers, Rich. > If there is someone who would be able to do a good job of maintaining and developing it, I would be delighted to have them take over responsibility for it. My current time demands and interests make it difficult for me to spend time on Splint these days. Any volunteers? --- Dave