0

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; 
Tiago Duque
  • 1,956
  • 1
  • 12
  • 31

1 Answers1

2

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Could the SIGILL be related to unit reference issues? – Tiago Duque Apr 28 '15 at 19:46
  • I don't know what that means. I thought you wanted to know what a SIGILL was. – David Heffernan Apr 28 '15 at 19:50
  • David, thanks for the help once again. It seems it was something related to data corruption for I made no changes to the files and they started to work once again after I restarted Lazarus. Your answer gave me a good hint. – Tiago Duque Apr 28 '15 at 20:07