[PATCH] Avoid segfault when code is present after a goto statement
commitfaa939b386004bdb1c2aaf277f6fb7ac333f89d3
authorLuc Van Oostenryck <luc.vanoostenryck@looxix.net>
Sun, 26 Jun 2005 23:31:15 +0000 (27 01:31 +0200)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 27 Jun 2005 00:21:17 +0000 (26 17:21 -0700)
tree66fcc9988ae1dbb025a0159fe3c0743e60cbbfdc
parenta5213d6e3a438ef366d23f7b2b793a96a003e5ec
[PATCH] Avoid segfault when code is present after a goto statement

Sparse can segfault when code is present after a goto statement.

The problem arises because after a goto statement (same with break and
continue) ep->active is set to NULL but processing of code present after
this statement can dereference ep->active (alloc_phi()).

The following piece of code reproduce the problem:

static int foo(int a)
{
goto end;
return a ? : b;

end:
return 0;
}

From what I have tested, the whole "a ? : b;" is needed to reproduce the
problem, with absent true part of the conditional and a undefined second
part; but the problem seems very general.

The following fixes the problem by checking for NULL ep->active, but
I suppose that there is nicer way to solve this problem.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@looxix.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
linearize.c