tbs0105.pp 968 B

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