Skip to content

Compiler 3.3.1 terminates with access violation, after previous error in code.

Fpc 3.3.1 and 3.2.3 (both from Dec 2021) crashes with the following code.

The code is wrong, and can not be compiled. An error for using TBar in "implements" is printed. But then an access violation happens

program Project1;
{$mode objfpc}{$H+}{$Interfaces CORBA}

type
  ITest = interface
  end;

  TBar = class;

  TFoo = class(TObject, ITest)
    Fa: TBar;
    property a: TBar read Fa implements ITest;
  end;

  TBar = class(TObject, ITest)
  end;

begin
end.
Free Pascal Compiler version 3.3.1 [2021/12/10] for x86_64
(1002) Target OS: Win64 for x64
(3104) Compiling C:\Users\martin\AppData\Local\Temp\project1.lpr
C:\Users\martin\AppData\Local\Temp\project1.lpr(12,46) Error: (3245) Class "TBar" does not implement interface "ITest"
C:\Users\martin\AppData\Local\Temp\project1.lpr(13,3) Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
An unhandled exception occurred at $000000010008C205:
EAccessViolation: Access violation
  $000000010008C205  bind,  line 3094 of symdef.pas
  $00000001001C0886  struct_property_dec,  line 217 of pdecobj.pas
  $00000001001C35D8  parse_object_members,  line 1363 of pdecobj.pas
  $00000001001C4310  object_dec,  line 1619 of pdecobj.pas
  $00000001001D89C0  read_named_type,  line 1900 of ptype.pas
  $00000001001B7678  types_dec,  line 911 of pdecl.pas
  $00000001001B853E  type_dec,  line 1217 of pdecl.pas
  $000000010011DDE1  read_declarations,  line 3031 of psub.pas
  $00000001001189E1  block,  line 381 of psub.pas
  $000000010011CD72  parse_body,  line 2453 of psub.pas
  $00000001002187F3  proc_program,  line 2226 of pmodules.pas
  $000000010004CAE1  compile,  line 410 of parser.pas
  $000000010001EF91  Compile,  line 288 of compiler.pas
  $0000000100001B31  $main,  line 301 of pp.pas
  $0000000100002306  main_wrapper
  $0000000100017220  Exe_entry,  line 83 of x86_64/cpuwin.inc
  $0000000100001914  _FPC_mainCRTStartup,  line 107 of sysinit.pp
Error: C:\FPC\fpc_3.3.1\64\gw3\bin\x86_64-win64\ppcx64.exe returned an error exitcode
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information