[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>