tbs0105.pp 798 B

12345678910111213141516171819202122232425262728293031323334
  1. {$R+}
  2. { BOUND check error... I don't think this is a code generator error }
  3. { but an error because the type casting is not considered at all! }
  4. { Must be compiled with -Cr }
  5. {$ifdef go32v2}
  6. uses dpmiexcp;
  7. {$endif go32v2}
  8. {$ifdef linux}
  9. uses linux;
  10. {$endif linux}
  11. function our_sig(l : longint) : longint;{$ifdef linux}cdecl;{$endif}
  12. begin
  13. { If we land here the program works correctly !! }
  14. Writeln('Bound check error signal recieved');
  15. our_sig:=0;
  16. Halt(0);
  17. end;
  18. Var
  19. Sel: Word;
  20. v: longint;
  21. Begin
  22. Signal(SIGSEGV,signalhandler(our_sig));
  23. v:=$00ffffff;
  24. Sel:=word(v);
  25. writeln(sel);
  26. { should trigger Bound check error }
  27. sel:=v;
  28. { we should not go to here }
  29. Writeln('Error : signal not called');
  30. Halt(1);
  31. end.