fpc/tests/tbs0105.pp
1999-10-13 12:42:09 +00:00

48 lines
968 B
ObjectPascal

{$ifdef go32v2}
{$define OK}
{$endif}
{$ifdef linux}
{$define OK}
{$endif}
{ Win32 signal support is still missing ! }
{$ifdef OK}
{$R+}
{ BOUND check error... I don't think this is a code generator error }
{ but an error because the type casting is not considered at all! }
{ Must be compiled with -Cr }
{$ifdef go32v2}
uses dpmiexcp;
{$endif go32v2}
{$ifdef linux}
uses linux;
{$endif linux}
function our_sig(l : longint) : longint;{$ifdef linux}cdecl;{$endif}
begin
{ If we land here the program works correctly !! }
Writeln('Bound check error signal recieved');
our_sig:=0;
Halt(0);
end;
Var
Sel: Word;
v: longint;
{$endif OK}
Begin
{$ifdef OK}
Signal(SIGSEGV,signalhandler(@our_sig));
v:=$00ffffff;
Sel:=word(v);
writeln(sel);
{ should trigger Bound check error }
sel:=v;
{ we should not go to here }
Writeln('Error : signal not called');
Halt(1);
{$endif OK}
end.