1 From owner-lclint-interest@virginia.edu Fri May 25 20:18 EDT 2001
2 X-Mailer: exmh version 2.2 06/23/2000 with version: MH 6.8.3 #8[UCI]
3 To: lclint-interest@cs.virginia.edu
4 Subject: lack of control flow analysis
6 Date: Fri, 25 May 2001 17:12:18 -0700
7 From: Mathew Yeates <mathew@fugue.jpl.nasa.gov>
9 Content-Type: text/plain; charset=us-ascii
13 I did some more work on the problem I sent yesterday. Here is a slightly
15 Even though line 14 is never executed, it causes s->i to go dead because
17 "only" param. And, even if line 13 were executed, line 18 would not be
19 because of the "return" statement. It appears that lclint cannot tell when a
21 is impossible in a particular context.
23 The error I get from the following program is
24 t.c:18:7: Dead storage s->i passed as out parameter: s->i
29 2 int foo( /*@out@*/char * b );
32 5 /*@reldef@ *//*@relnull@ */ char *i;
35 8 static int redir(struct s *s)
37 10 s->i = malloc(1 * sizeof(int));
44 17 if (foo(s->i) == 1) {
46 19 /*@-usereleased@ */
48 21 /*@=usereleased@ */
50 23 /*@-usereleased@ */
52 25 /*@=usereleased@ */
58 31 if (redir(&s) == 1) exit(0);