fpc/tests/webtbs/tw9073.pp
2016-07-13 15:21:23 +00:00

48 lines
616 B
ObjectPascal

{%skiptarget=$nothread }
{ %opt=-CN }
{ the -CN is to generated null pointer load checks for AIX,
ignored on other platforms because there the OS performs
this checking for you }
{$mode objfpc}
uses
{$ifdef unix}
cthreads,
{$endif}
SysUtils, Classes;
type
tc = class(tthread)
procedure execute; override;
end;
var
caught: boolean;
procedure tc.execute;
type
plongint = ^longint;
var
p: plongint;
begin
p:=nil;
try
writeln(p^);
except
caught:=true;
end;
end;
var
c: tc;
begin
caught:=false;
c:=tc.create(false);
c.waitfor;
c.free;
halt(ord(not caught));
end.