Ver código fonte

compiler: added module state ms_compiled_waitcrc and delay writing ppu until all used unit crcs are computed

mattias 1 semana atrás
pai
commit
329442eb27

+ 38 - 10
compiler/ctask.pas

@@ -34,14 +34,14 @@ type
   { ttask_list }
 
   ttask_list = class(tlinkedlistitem)
-     module : tmodule;
-     state : tglobalstate;
-     constructor create(_m : tmodule);
-     destructor destroy; override;
-     procedure SaveState;
-     Procedure RestoreState;
-     procedure DiscardState;
-     function nexttask : ttask_list; inline;
+    module : tmodule;
+    state : tglobalstate;
+    constructor create(_m : tmodule);
+    destructor destroy; override;
+    procedure SaveState;
+    procedure RestoreState;
+    procedure DiscardState;
+    function nexttask : ttask_list; inline;
   end;
 
   ttasklinkedlist = class(tlinkedlist)
@@ -220,6 +220,7 @@ begin
     ms_compiling_waitintf : cancontinue:=m.usedunitsloaded(true,firstwaiting);
     ms_compiling_waitimpl : cancontinue:=m.usedunitsloaded(false,firstwaiting);
     ms_compiling_waitfinish : cancontinue:=m.nowaitingforunits(firstwaiting);
+    ms_compiled_waitcrc : cancontinue:=m.usedunitsfinalcrc(firstwaiting);
     ms_compiled : cancontinue:=true;
     ms_processed : cancontinue:=true;
     ms_moduleerror : cancontinue:=true;
@@ -273,11 +274,13 @@ begin
     ms_compiling_wait : pmodules.proc_program_declarations(m,m.islibrary);
     ms_compiling_waitintf : pmodules.parse_unit_interface_declarations(m);
     ms_compiling_waitimpl : pmodules.proc_unit_implementation(m);
-    ms_compiling_waitfinish : pmodules.finish_unit(m);
+    ms_compiling_waitfinish : pmodules.finish_compile_unit(m);
+    ms_compiled_waitcrc : pmodules.finish_unit(m);
     ms_processed : ;
   else
     InternalError(2024011801);
   end;
+
   if m.state=ms_compiled then
     begin
     parsing_done(m);
@@ -322,14 +325,39 @@ procedure ttask_handler.processqueue;
 
 var
   t,t2 : ttask_list;
-  process : boolean;
+  process: boolean;
   dummy,firstwaiting : tmodule;
 
 begin
   t:=list.firsttask;
+  process:=true;
   While t<>nil do
     begin
+
+    if process then
+      begin
+      // first search for any module that is ready to be written as ppu
+      t2:=list.firsttask;
+      while (t2<>nil)
+          and ((t2.module.state<>ms_compiled_waitcrc)
+            or not t2.module.usedunitsfinalcrc(firstwaiting)) do
+        t2:=t2.nexttask;
+      if t2<>nil then
+        begin
+        t:=t2;
+        {$IFDEF Debug_Mattias}
+        writeln('ttask_handler.processqueue FOUND CRC READY ',t.module.realmodulename^,' state=',t.module.state);
+        {$ENDIF}
+        end;
+      end;
+
     process:=cancontinue(t,firstwaiting);
+    {$IFDEF Debug_Mattias}
+    if firstwaiting<>nil then
+      writeln('ttask_handler.processqueue "',t.module.realmodulename^,'" state=',t.module.state,' waitingfor="',firstwaiting.realmodulename^,'",',firstwaiting.state)
+    else
+      writeln('ttask_handler.processqueue "',t.module.realmodulename^,'" state=',t.module.state,' waitingfor=nil');
+    {$ENDIF}
     if process then
       begin
       if continue(t) then

+ 2 - 0
compiler/finput.pas

@@ -122,6 +122,7 @@ interface
           ms_compiling_waitintf,  // waiting for used units of interface section
           ms_compiling_waitimpl,  // waiting for used units of implementation section
           ms_compiling_waitfinish,// after impl section parsed, waiting for other impl sections needed by specializations
+          ms_compiled_waitcrc,   // after computing own CRC, waiting for used units' CRCs
           ms_compiled,   // compiling complete, ppu written
           ms_processed,  // task complete
           ms_moduleerror // not yet used: eventually set on error
@@ -138,6 +139,7 @@ interface
           'Compiling_Waiting_interface',
           'Compiling_Waiting_implementation',
           'Compiling_Waiting_finish',
+          'Compiled_Waiting_crc',
           'Compiled',
           'Processed',
           'Error'

+ 28 - 4
compiler/fmodule.pas

@@ -129,6 +129,7 @@ interface
         interface_only: boolean; { interface-only macpas unit; flag does not need saving/restoring to ppu }
         mainfilepos   : tfileposinfo;
         recompile_reason : trecompile_reason;  { the reason why the unit should be recompiled }
+        crc_final: boolean;
         crc,
         interface_crc,
         indirect_crc  : cardinal;
@@ -263,6 +264,7 @@ interface
         function findusedunit(m : tmodule) : tused_unit;
         function usedunitsloaded(interface_units: boolean; out firstwaiting : tmodule): boolean;
         function nowaitingforunits(out firstwaiting : tmodule) : Boolean;
+        function usedunitsfinalcrc(out firstwaiting : tmodule): boolean;
         procedure updatemaps;
         function  derefidx_unit(id:longint):longint;
         function  resolve_unit(id:longint):tmodule;
@@ -513,7 +515,7 @@ implementation
         in_interface:=intface;
         in_uses:=inuses;
         unitsym:=usym;
-        if _u.state in [ms_compiled,ms_processed] then
+        if _u.state in [ms_compiled_waitcrc,ms_compiled,ms_processed] then
          begin
            checksum:=u.crc;
            interface_checksum:=u.interface_crc;
@@ -609,6 +611,7 @@ implementation
         linkotherframeworks:=TLinkContainer.Create;
         mainname:=nil;
         FImportLibraryList:=TFPHashObjectList.Create(true);
+        crc_final:=false;
         crc:=0;
         interface_crc:=0;
         indirect_crc:=0;
@@ -972,6 +975,7 @@ implementation
         localframeworksearchpath:=TSearchPathList.Create;
         moduleoptions:=[];
         is_dbginfo_written:=false;
+        crc_final:=false;
         crc:=0;
         interface_crc:=0;
         indirect_crc:=0;
@@ -1037,7 +1041,7 @@ implementation
              this unit, unless this unit is already compiled during
              the loading }
            m:=pm.u;
-           if (m=callermodule) and (m.state<ms_compiled) then
+           if (m=callermodule) and (m.state<ms_compiled_waitcrc) then
              Message1(unit_u_no_reload_is_caller,m.modulename^)
            else
             if (m.state=ms_compile) {and (pm.u.compilecount>1)} then
@@ -1072,8 +1076,8 @@ implementation
 
       const
         statesneeded : array[boolean] of tmodulestates = (
-          [ms_processed, ms_compiled,ms_compiling_waitimpl, ms_compiling_waitfinish],
-          [ms_processed, ms_compiled,ms_compiling_waitimpl, ms_compiling_waitfinish]);
+          [ms_processed, ms_compiled, ms_compiling_waitimpl, ms_compiling_waitfinish, ms_compiled_waitcrc],
+          [ms_processed, ms_compiled, ms_compiling_waitimpl, ms_compiling_waitfinish, ms_compiled_waitcrc]);
 
       var
         itm : TLinkedListItem;
@@ -1111,6 +1115,26 @@ implementation
           firstwaiting:=tmodule(waitingforunit[0]);
       end;
 
+    function tmodule.usedunitsfinalcrc(out firstwaiting: tmodule): boolean;
+
+    var
+      itm: TLinkedListItem;
+
+    begin
+      Result:=True;
+      itm:=self.used_units.First;
+      firstwaiting:=Nil;
+      while assigned(itm) do
+        begin
+        if not tused_unit(itm).u.crc_final then
+          begin
+          firstwaiting:=tused_unit(itm).u;
+          exit(false);
+          end;
+        itm:=itm.Next;
+        end;
+    end;
+
     function tmodule.usesmodule_in_interface(m: tmodule): boolean;
 
       var

+ 30 - 8
compiler/fppu.pas

@@ -431,9 +431,10 @@ var
             exit;
           end;
 
-      { Load values to be access easier }
+      { Load values for easier access }
         headerflags:=ppufile.header.common.flags;
         crc:=ppufile.header.checksum;
+        crc_final:=true;
         interface_crc:=ppufile.header.interface_checksum;
         indirect_crc:=ppufile.header.indirect_checksum;
         change_endian:=ppufile.change_endian;
@@ -871,7 +872,7 @@ var
         hp  : tinputfile;
         ifile : sizeint;
       begin
-      { second write the used source files }
+      { write the used source files }
         ppufile.do_crc:=false;
       { write source files directly in good order }
         for ifile:=0 to sourcefiles.nfiles-1 do
@@ -889,24 +890,35 @@ var
       var
         hp : tused_unit;
         oldcrc : boolean;
+        u: tmodule;
       begin
         { write a reference for each used unit }
+        {$IFDEF Debug_Mattias}
+        writeln('tppumodule.writeusedunit START ',realmodulename^,' intf=',intf);
+        {$ENDIF}
         hp:=tused_unit(used_units.first);
         while assigned(hp) do
          begin
            if hp.in_interface=intf then
              begin
-               ppufile.putstring(hp.u.realmodulename^);
+               u:=hp.u;
+               ppufile.putstring(u.realmodulename^);
                { the checksum should not affect the crc of this unit ! (PFV) }
                oldcrc:=ppufile.do_crc;
                ppufile.do_crc:=false;
+               {$IFDEF Debug_Mattias}
+               writeln('tppumodule.writeusedunit ',u.realmodulename^,' crc=',hexstr(u.crc,8),' interface_crc=',hexstr(u.interface_crc,8),' indirect_crc=',hexstr(u.indirect_crc,8));
+               {$ENDIF}
+               hp.checksum:=u.crc;
+               hp.interface_checksum:=u.interface_crc;
+               hp.indirect_checksum:=u.indirect_crc;
                ppufile.putlongint(longint(hp.checksum));
                ppufile.putlongint(longint(hp.interface_checksum));
                ppufile.putlongint(longint(hp.indirect_checksum));
                ppufile.do_crc:=oldcrc;
                { combine all indirect checksums from units used by this unit }
                if intf then
-                 ppufile.indirect_crc:=ppufile.indirect_crc xor hp.indirect_checksum;
+                 ppufile.indirect_crc:=ppufile.indirect_crc xor u.indirect_crc;
              end;
            hp:=tused_unit(hp.next);
          end;
@@ -1628,6 +1640,9 @@ var
 
     procedure tppumodule.writeppu;
       begin
+        {$IFDEF Debug_Mattias}
+        writeln('tppumodule.writeppu ',realmodulename^);
+        {$ENDIF}
          Message1(unit_u_ppu_write,realmodulename^);
 
          { create unit flags }
@@ -1825,9 +1840,13 @@ var
          ppufile.writeheader;
 
          { save crc in current module also }
+         crc_final:=true;
          crc:=ppufile.crc;
          interface_crc:=ppufile.interface_crc;
          indirect_crc:=ppufile.indirect_crc;
+         {$IFDEF Debug_Mattias}
+         writeln('tppumodule.writeppu ',realmodulename^,' crc=',hexstr(crc,8));
+         {$ENDIF}
 
 {$ifdef Test_Double_checksum_write}
          Writeln(ppufile.CRCFile,'End of implementation CRC in writeppu method of ',ppufilename,
@@ -1915,6 +1934,9 @@ var
          crc:=ppufile.crc;
          interface_crc:=ppufile.interface_crc;
          indirect_crc:=ppufile.indirect_crc;
+         {$IFDEF Debug_Mattias}
+         writeln('tppumodule.getppucrc ',realmodulename^,' crc=',hexstr(crc,8));
+         {$ENDIF}
 
          { end of implementation, to generate a correct ppufile
            for ppudump when using DEBUG_GENERATE_INTERFACE_PPU define }
@@ -2170,7 +2192,7 @@ var
              is nothing to resolve }
            if interface_compiled and
              { it makes no sense to re-resolve the unit if it is already finally compiled }
-             not(state=ms_compiled) then
+               not (state in [ms_compiled_waitcrc,ms_compiled,ms_processed]) then
              begin
                re_resolve(from_module);
              end
@@ -2203,9 +2225,9 @@ var
       procedure tppumodule.prepare_second_load(from_module: tmodule);
 
       const
-         CompileStates  = [ms_compile, ms_compiling_waitintf, ms_compiling_waitimpl,
-                           ms_compiling_waitfinish, ms_compiling_wait, ms_compiled,
-                           ms_processed];
+         CompileStates  = [ms_compile, ms_compiling_wait,
+                           ms_compiling_waitintf, ms_compiling_waitimpl, ms_compiling_waitfinish,
+                           ms_compiled_waitcrc, ms_compiled, ms_processed];
 
         begin
           { try to load the unit a second time first }

+ 3 - 2
compiler/pgenutil.pas

@@ -288,7 +288,7 @@ uses
         if (hmodule.state = ms_load) and hmodule.interface_compiled then
           Exit;
 
-        if not (hmodule.state in [ms_compiled,ms_processed]) then
+        if not (hmodule.state in [ms_compiled_waitcrc,ms_compiled,ms_processed]) then
           begin
 {$ifdef DEBUG_UNITWAITING}
             Writeln('Unit ', current_module.modulename^,
@@ -2989,7 +2989,8 @@ uses
                     generic was declared in the same unit (otherwise there
                     should be one) }
                   mstate:=hmodule.state;
-                  if ((hmodule=current_module) or (hmodule.state<ms_compiling_waitfinish)) and tprocdef(def.genericdef).forwarddef then
+                  if ((hmodule=current_module) or (hmodule.state<ms_compiling_waitfinish))
+                      and tprocdef(def.genericdef).forwarddef then
                     begin
                       readdlist.add(def);
                       continue;

+ 110 - 75
compiler/pmodules.pas

@@ -33,7 +33,8 @@ uses fmodule;
     function proc_package(curr: tmodule) : boolean;
     function proc_program(curr: tmodule; islibrary : boolean) : boolean;
     function proc_program_declarations(curr : tmodule; islibrary : boolean) : boolean;
-    procedure finish_unit(module:tmodule);
+    function finish_compile_unit(module:tmodule): boolean;
+    function finish_unit(module:tmodule): boolean;
 
 implementation
 
@@ -1219,7 +1220,7 @@ type
         curr.finishstate:=finishstate;
 
         if result then
-          finish_unit(curr)
+          result:=finish_compile_unit(curr)
         else
           curr.state:=ms_compiling_waitfinish;
       end;
@@ -1289,7 +1290,10 @@ type
         if (target_cpu=tsystemcpu.cpu_wasm32) then
           add_synthetic_interface_classes_for_st(curr.globalsymtable,true,false);
 
-        { Our interface is compiled, generate CRC and switch to implementation }
+        { Our interface is compiled, generate interface CRC and switch to implementation }
+        {$IFDEF Debug_Mattias}
+        writeln('parse_unit_interface_declarations ',curr.realmodulename^);
+        {$ENDIF}
         if not(cs_compilesystem in current_settings.moduleswitches) and
           (Errorcount=0) then
            tppumodule(curr).getppucrc;
@@ -1343,7 +1347,7 @@ type
         { Can we continue compiling ? }
         result:=curr.state<>ms_compiling_waitimpl;
         if result then
-          result:=proc_unit_implementation(curr)
+          result:=proc_unit_implementation(curr);
       end;
 
     function proc_unit(curr: tmodule):boolean;
@@ -1509,7 +1513,13 @@ type
            result:=parse_unit_interface_declarations(curr);
       end;
 
-    procedure finish_unit(module:tmodule);
+    procedure module_is_done(curr: tmodule);inline;
+      begin
+        dispose(pfinishstate(curr.finishstate));
+        curr.finishstate:=nil;
+      end;
+
+    function finish_compile_unit(module: tmodule): boolean;
 
       function is_assembler_generated:boolean;
       var
@@ -1527,18 +1537,10 @@ type
           end;
       end;
 
-      procedure module_is_done(curr: tmodule);inline;
-        begin
-          dispose(pfinishstate(curr.finishstate));
-          curr.finishstate:=nil;
-        end;
-
       var
 {$ifdef EXTDEBUG}
         store_crc,
 {$endif EXTDEBUG}
-        store_interface_crc,
-        store_indirect_crc: cardinal;
         force_init_final : boolean;
         init_procinfo,
         finalize_procinfo : tcgprocinfo;
@@ -1547,6 +1549,7 @@ type
         finishstate : tfinishstate;
         waitingmodule : tmodule;
       begin
+         result:=true;
          { curr is now module }
 
          if not assigned(module.finishstate) then
@@ -1740,43 +1743,76 @@ type
            end;
 
          if ag then
+           begin
+             { create callframe info }
+             create_dwarf_frame;
+             { assemble }
+             create_objectfile(module);
+           end;
+
+        // compute CRC
+        if ErrorCount=0 then
           begin
-            { create callframe info }
-            create_dwarf_frame;
-            { assemble }
-            create_objectfile(module);
+          if not module.usedunitsfinalcrc(waitingmodule) then
+            begin
+            { Some used units are still compiling, so their CRCs can change.
+              Compute the final CRC of this module, for the case of a
+              circular dependency, and wait.
+            }
+            {$IFDEF Debug_Mattias}
+            writeln('finish_compile_unit ',module.realmodulename^,' waiting for used unit CRCs...');
+            {$ENDIF}
+            tppumodule(module).getppucrc;
+            module.crc_final:=true;
+            module.state:=ms_compiled_waitcrc;
+            exit(false);
+            end;
           end;
 
-         { Write out the ppufile after the object file has been created }
-         store_interface_crc:=module.interface_crc;
-         store_indirect_crc:=module.indirect_crc;
+        result:=finish_unit(module);
+      end;
+
+    function finish_unit(module: tmodule): boolean;
+
+      var
+        store_interface_crc,
+        store_indirect_crc : cardinal;
+        i : longint;
+        waitingmodule : tmodule;
+
+      begin
+        result:=true;
+
+        { Write out the ppufile after the object file has been created }
+        store_interface_crc:=module.interface_crc;
+        store_indirect_crc:=module.indirect_crc;
 {$ifdef EXTDEBUG}
-         store_crc:=module.crc;
+        store_crc:=module.crc;
 {$endif EXTDEBUG}
-         if (Errorcount=0) then
-           tppumodule(module).writeppu;
+        if ErrorCount=0 then
+          tppumodule(module).writeppu;
 
-         if not(cs_compilesystem in current_settings.moduleswitches) then
-           begin
-             if store_interface_crc<>module.interface_crc then
-               Message1(unit_u_interface_crc_changed,module.ppufilename);
-             if store_indirect_crc<>module.indirect_crc then
-               Message1(unit_u_indirect_crc_changed,module.ppufilename);
-           end;
+        if not(cs_compilesystem in current_settings.moduleswitches) then
+          begin
+            if store_interface_crc<>module.interface_crc then
+              Message1(unit_u_interface_crc_changed,module.ppufilename);
+            if store_indirect_crc<>module.indirect_crc then
+              Message1(unit_u_indirect_crc_changed,module.ppufilename);
+          end;
 {$ifdef EXTDEBUG}
-         if not(cs_compilesystem in current_settings.moduleswitches) then
-           if (store_crc<>module.crc) then
-             Message1(unit_u_implementation_crc_changed,module.ppufilename);
+        if not(cs_compilesystem in current_settings.moduleswitches) then
+          if (store_crc<>module.crc) then
+            Message1(unit_u_implementation_crc_changed,module.ppufilename);
 {$endif EXTDEBUG}
 
-         { release unregistered defs/syms from the localsymtable }
-         free_unregistered_localsymtable_elements(module);
-         { release local symtables that are not needed anymore }
-         free_localsymtables(module.globalsymtable);
-         free_localsymtables(module.localsymtable);
+        { release unregistered defs/syms from the localsymtable }
+        free_unregistered_localsymtable_elements(module);
+        { release local symtables that are not needed anymore }
+        free_localsymtables(module.globalsymtable);
+        free_localsymtables(module.localsymtable);
 
-         { leave when we got an error }
-         if (Errorcount>0) and not status.skip_error then
+        { leave when we got an error }
+        if (Errorcount>0) and not status.skip_error then
           begin
             Message1(unit_f_errors_in_unit,tostr(Errorcount));
             status.skip_error:=true;
@@ -1788,41 +1824,41 @@ type
           end;
 
 {$ifdef debug_devirt}
-         { print out all instantiated class/object types }
-         writeln('constructed object/class/classreftypes in ',module.realmodulename^);
-         for i := 0 to module.wpoinfo.createdobjtypes.count-1 do
-           begin
-             write('  ',tdef(module.wpoinfo.createdobjtypes[i]).GetTypeName);
-             case tdef(module.wpoinfo.createdobjtypes[i]).typ of
-               objectdef:
-                 case tobjectdef(module.wpoinfo.createdobjtypes[i]).objecttype of
-                   odt_object:
-                     writeln(' (object)');
-                   odt_class:
-                     writeln(' (class)');
-                   else
-                     internalerror(2008101103);
-                 end;
-               else
-                 internalerror(2008101104);
-             end;
-           end;
+        { print out all instantiated class/object types }
+        writeln('constructed object/class/classreftypes in ',module.realmodulename^);
+        for i := 0 to module.wpoinfo.createdobjtypes.count-1 do
+          begin
+            write('  ',tdef(module.wpoinfo.createdobjtypes[i]).GetTypeName);
+            case tdef(module.wpoinfo.createdobjtypes[i]).typ of
+              objectdef:
+                case tobjectdef(module.wpoinfo.createdobjtypes[i]).objecttype of
+                  odt_object:
+                    writeln(' (object)');
+                  odt_class:
+                    writeln(' (class)');
+                  else
+                    internalerror(2008101103);
+                end;
+              else
+                internalerror(2008101104);
+            end;
+          end;
 
-         for i := 0 to module.wpoinfo.createdclassrefobjtypes.count-1 do
-           begin
-             write('  Class Of ',tdef(module.wpoinfo.createdclassrefobjtypes[i]).GetTypeName);
-             case tdef(module.wpoinfo.createdclassrefobjtypes[i]).typ of
-               objectdef:
-                 case tobjectdef(module.wpoinfo.createdclassrefobjtypes[i]).objecttype of
-                   odt_class:
-                     writeln(' (classrefdef)');
-                   else
-                     internalerror(2008101105);
-                 end
-               else
-                 internalerror(2008101102);
-             end;
-           end;
+        for i := 0 to module.wpoinfo.createdclassrefobjtypes.count-1 do
+          begin
+            write('  Class Of ',tdef(module.wpoinfo.createdclassrefobjtypes[i]).GetTypeName);
+            case tdef(module.wpoinfo.createdclassrefobjtypes[i]).typ of
+              objectdef:
+                case tobjectdef(module.wpoinfo.createdclassrefobjtypes[i]).objecttype of
+                  odt_class:
+                    writeln(' (classrefdef)');
+                  else
+                    internalerror(2008101105);
+                end
+              else
+                internalerror(2008101102);
+            end;
+          end;
 {$endif debug_devirt}
 
         Message1(unit_u_finished_compiling,module.modulename^);
@@ -1841,7 +1877,6 @@ type
 {$endif DEBUG_NODE_XML}
       end;
 
-
     function proc_package(curr: tmodule) : boolean;
       var
         main_file : tinputfile;

+ 1 - 3
compiler/ppcx64.lpi

@@ -23,9 +23,7 @@
     </PublishOptions>
     <RunParams>
       <local>
-        <CommandLineParams Value="-Tlinux -tunicodertl -FUrtl-objpas\units\x86_64-linux-unicodertl\ -Fu\home\tixeo\FPC\FPC\src\rtl\units\x86_64-linux-unicodertl\ -Furtl-objpas\src\inc -Furtl-objpas\src\common -Firtl-objpas\src\inc -Firtl-objpas\src\linux -Firtl-objpas\src\x86_64 -Firtl-objpas\src\common -Fl\usr\lib\gcc\x86_64-linux-gnu\11 -tunicodertl -Cg -Fl\usr\lib\gcc\x86_64-linux-gnu\11 -gl -dx86_64 -Sc -viq rtl-objpas\BuildUnit_rtl_objpas.pp"/>
         <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
-        <WorkingDirectory Value="\home\tixeo\fpc\packages"/>
       </local>
       <FormatVersion Value="2"/>
       <Modes Count="1">
@@ -62,8 +60,8 @@
       <SyntaxOptions>
         <CStyleOperator Value="False"/>
         <AllowLabel Value="False"/>
-        <CPPInline Value="False"/>
         <UseAnsiStrings Value="False"/>
+        <CPPInline Value="False"/>
       </SyntaxOptions>
     </Parsing>
     <Other>

+ 1 - 1
compiler/symtype.pas

@@ -1271,7 +1271,7 @@ implementation
           putlongint(d.dataidx)
         else
 {$endif}
-        if d.dataidx=-1 then
+        if (d.dataidx=-1) and not crc_only then
           internalerror(2019022201)
         else
           putlongint(d.dataidx);