[splint-discuss] Passed storage not completely defined
bofh1234 at hotmail.com
Wed Jan 27 18:47:42 PST 2010
From: Michael.Wojcik at microfocus.com
But Perm has been initialized - it points to the same
object as "array" in main, which was initialized from the values in
And while Permute does not operate on the contents pointed to by
the values in the Perm array, it does use those values (as it rearranges them).
So an @out@ annotation would be incorrect, even if it suppresses the error.
I don't see any reasonable interpretation here other than that
the diagnostic from Splint is incorrect. In the call to Permute in main, "*array"
is identical to "array", and array has been initialized unless
one of the following holds:
- argc < 2 (and the program should have checked for this,
since it causes undefined behavior if argc==0 and implementation-defined
behavior if argc==1, both of which are possible)
- argv is undefined (which should not happen in a hosted
implementation if argc >= 2, and Splint should know that)
Some other criticisms might be leveled against the code (why is
temp in Permute an array, when only the first element is ever used?), but
unless I'm missing something, this is an incorrect diagnostic from Splint.
The code I posted was an example program that demonstates the problem in as small a working program as possible. The whole program is to large to post. In the real program I do check the argument count.
Good point about the temp array. I don't know what the answer is; I didn't write that code. I will fix it in my version.
Hotmail: Powerful Free email with security by Microsoft.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the splint-discuss