Search code examples
delphiexceptionlazarusfpc

SIGILL Exception in Lazarus


After working fine for a while, my code started to raise a SIGILL exception when used. I didn't understand the documentation. What does the SIGILL exception means in practical therms?

This is the code that is raising the exception, could you help me pointing out why?

function TfrmPascal.valorElemento(lin, col: integer): integer;
begin
     if lin < 0 then valorElemento:= 0 
     else if col < 0 then valorElemento:= 0
     else if (col=0) or (col = lin) then valorElemento:=1
     else valorElemento:= valorElemento(lin-1, col-1) + valorElemento(lin-1, col);
end; 

Solution

  • SIGILL is a signal issued when a illegal instruction is encountered. If the code in your question is resulting in SIGILL that would suggest one of the following:

    1. Your executable is corrupt.
    2. Your compiler has emitted defective code.
    3. You are attempting to execute data rather than code.

    The final option is the most likely. This might happen if you have written off the end of an array, corrupted the stack, etc.

    The code in the question appears, in itself, to be quite harmless. Almost certainly the defect in your code lies elsewhere.