View Issue Details

IDProjectCategoryView StatusLast Update
0028814FPCCompilerpublic2016-07-05 23:05
ReporterAndrey Zubarev Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformwin32 
Fixed in Version3.1.1 
Summary0028814: Crash when compile
DescriptionUnfortunately I can't make a minimal example, only stack

trunc fpc rev31987

Fatal: (1018) Compilation aborted
An unhandled exception occurred at $0043B3F0:
EAccessViolation: Access violation
  $0043B3F0 TMODULE__ADDDEPENDENCY, line 857 of fmodule.pas
  $0056CCF6 LOADUNITS, line 497 of pmodules.pas
  $0056D910 PROC_UNIT, line 858 of pmodules.pas
  $0043C4C8 COMPILE, line 383 of parser.pas
  $00564865 TPPUMODULE__LOADPPU, line 1742 of fppu.pas
  $0056CCD0 LOADUNITS, line 492 of pmodules.pas
  $0056D910 PROC_UNIT, line 858 of pmodules.pas
  $0043C4C8 COMPILE, line 383 of parser.pas
  $00564865 TPPUMODULE__LOADPPU, line 1742 of fppu.pas
  $0056CCD0 LOADUNITS, line 492 of pmodules.pas
  $0056DC2F PROC_UNIT, line 949 of pmodules.pas
  $0043C4C8 COMPILE, line 383 of parser.pas
  $00564865 TPPUMODULE__LOADPPU, line 1742 of fppu.pas
  $0056CCD0 LOADUNITS, line 492 of pmodules.pas
  $0056D910 PROC_UNIT, line 858 of pmodules.pas
  $0043C4C8 COMPILE, line 383 of parser.pas
  $00564865 TPPUMODULE__LOADPPU, line 1742 of fppu.pas

Error: E:\pp\bin\i386-win32\ppc386.exe returned an error exitcode
TagsNo tags attached.
Fixed in Revision34069
FPCOldBugId
FPCTarget
Attached Files

Activities

Thaddy de Koning

2015-10-09 20:11

reporter   ~0086400

31994 builds, so this is probably an anomaly

Jonas Maebe

2015-10-09 22:40

manager   ~0086402

Without the source code that you tried to compile, we cannot do anything.

Andrey Zubarev

2015-10-10 20:49

reporter   ~0086415

I cannot make small example, the error manifests itself only in big app

Andrey Zubarev

2016-07-03 00:48

reporter   ~0093495

This problem was very annoying. It is impossible recompile a project, need -b option or delete old ppu`s. Can you tell what to do to localize the problem? Perhaps as example will not minimal program, but open source large app?

Similar problem http://bugs.freepascal.org/view.php?id=30289

Jonas Maebe

2016-07-03 09:57

manager   ~0093496

Yes, a large open source application is also possible, although it will be harder to debug and fix the issue.

To localise the problem, the only thing you can do is to systematically cut parts from your source code and try to reproduce it.

While it's possible that 0030289 is related, it's unlikely.

Andrey Zubarev

2016-07-03 22:28

reporter   ~0093517

Last edited: 2016-07-03 22:46

View 2 revisions

I tried to cut little by little, but nothing happened((

Project - http://svn.shamangrad.net/zcad/trunk/
For compile you need Lazarus with installed packages from http://svn.shamangrad.net/zcad/trunk/cad_source/components/
zebase, zcontainers, zscriptbase, zundostack, zmath, zscript, zcontrols, zobjectinspector

Step to reproduce:
1 - first compilation is successful
2 - mark http://svn.shamangrad.net/zcad/trunk/cad_source/zcad/core/drawings/uzcdrawing.pas file as edited (put space in any place)
3 - now the project can't be compiled (need delete ppu's or -b in option)

Andrey Zubarev

2016-07-04 19:36

reporter   ~0093541

It's probably some other error. the stack looks different

Hint: (11030) Start of reading config file E:\pp\bin\i386-win32\fpc.cfg
Hint: (11031) End of reading config file E:\pp\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 3.1.1 [2016/07/04] for i386
Copyright (c) 1993-2016 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
(3104) Compiling zcad.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawing.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawing.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawing.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\core\undostack\zcmultiobjectcreateundocommand.pas
(3104) Compiling .\zcad\core\utils\uzcutils.pas
(3104) Compiling .\zcad\lclmod\uzctreenode.pas
E:\zcad\cad_source\.\zcad\lclmod\uzctreenode.pas(88,36) Warning: (3057) An inherited method is hidden by "constructor create(TComponent;TTranslateString;TTranslateString);"
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\uzcshared.pas
(3104) Compiling .\zcad\commands\uzccommandsmanager.pas
.\components\zcontainers\lib\i386-win32\gzctnrvectorpdata.ppu:gzctnrvectorpdata.pas(27,40) Note: (5071) Private type "GZVectorPData$2<UZCCOMMANDSABSTRACT.PCommandObjectDef,UZCCOMMANDSABSTRACT.CommandObjectDef>.TData" never used
(3104) Compiling .\zcad\lclmod\uzcinfoform.pas
(3104) Compiling .\zcad\entities\uzcenitiesvariablesextender.pas
(3104) Compiling .\zcad\core\undostack\zcobjectchangeundocommand.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawing.pas
E:\zcad\cad_source\.\zcad\core\drawings\uzcdrawing.pas(20,2) Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
An unhandled exception occurred at $00429B5E:
EAccessViolation: Access violation
  $00429B5E TSEARCHPATHLIST__FINDFILE, line 1194 of cfileutl.pas
  $004C30DA FINDINCLUDEFILE, line 2393 of scanner.pas
  $004C2D38 DIR_INCLUDE, line 2476 of scanner.pas
  $004C640A TSCANNERFILE__HANDLEDIRECTIVES, line 3936 of scanner.pas
  $004C70AF TSCANNERFILE__SKIPCOMMENT, line 4457 of scanner.pas
  $004C741B TSCANNERFILE__READTOKEN, line 4614 of scanner.pas
  $005098E5 CONSUME, line 147 of pbase.pas
  $0056DAD1 PROC_UNIT, line 855 of pmodules.pas
  $0043D828 COMPILE, line 383 of parser.pas
  $005637D5 TPPUMODULE__LOADPPU, line 1947 of fppu.pas
  $005630B3 TPPUMODULE__RELOAD_FLAGGED_UNITS, line 1730 of fppu.pas
  $0056DE58 PROC_UNIT, line 964 of pmodules.pas
  $0043D828 COMPILE, line 383 of parser.pas
  $005637D5 TPPUMODULE__LOADPPU, line 1947 of fppu.pas
  $0056CEA0 LOADUNITS, line 501 of pmodules.pas
  $0056DC10 PROC_UNIT, line 896 of pmodules.pas
  $0043D828 COMPILE, line 383 of parser.pas

Error: E:\pp\bin\i386-win32\ppc386.exe returned an error exitcode

Andrey Zubarev

2016-07-05 00:22

reporter   ~0093548

I tried to solve it myself. There were 2 problems: first in $includes search, second in UNITWAITING. Attached patch solves both of them. Please check

Andrey Zubarev

2016-07-05 00:23

reporter  

two_problem_fix.patch (1,445 bytes)   
Index: compiler/pmodules.pas
===================================================================
--- compiler/pmodules.pas	(revision 34065)
+++ compiler/pmodules.pas	(working copy)
@@ -1027,7 +1027,9 @@
          Writeln('Units waiting for ', current_module.modulename^, ': ',
            current_module.waitingforunit.Count);
 {$endif}
-         result:=current_module.waitingforunit.count=0;
+         if assigned(current_module.waitingforunit) then
+           result:=current_module.waitingforunit.count=0
+         else result:=true;
 
          { save all information that is needed for finishing the unit }
          New(finishstate);
Index: compiler/scanner.pas
===================================================================
--- compiler/scanner.pas	(revision 34065)
+++ compiler/scanner.pas	(working copy)
@@ -2390,7 +2390,8 @@
                hpath:=current_scanner.inputfile.path+';'+CurDirRelPath(source_info);
                found:=FindFile(path+name, hpath,true,foundfile);
                if not found then
-                 found:=current_module.localincludesearchpath.FindFile(path+name,true,foundfile);
+                 if assigned(current_module.localincludesearchpath) then
+                   found:=current_module.localincludesearchpath.FindFile(path+name,true,foundfile);
                if not found  then
                  found:=includesearchpath.FindFile(path+name,true,foundfile);
              end;
two_problem_fix.patch (1,445 bytes)   

Jonas Maebe

2016-07-05 11:56

manager   ~0093551

Thanks, I'll try to have a look at it tonight.

Jonas Maebe

2016-07-05 20:41

manager  

tw28814-1.patch (1,276 bytes)   
diff --git a/compiler/fmodule.pas b/compiler/fmodule.pas
index 32d7a2c..4bb9733 100644
--- a/compiler/fmodule.pas
+++ b/compiler/fmodule.pas
@@ -815,6 +815,10 @@ implementation
         resourcefiles:=TCmdStrList.Create;
         pendingspecializations.free;
         pendingspecializations:=tfphashobjectlist.create(false);
+        if waitingforunit.count<>0 then
+          internalerror(2016070501);
+        waitingforunit.free;
+        waitingforunit:=tfpobjectlist.create(false);;
         linkunitofiles.Free;
         linkunitofiles:=TLinkContainer.Create;
         linkunitstaticlibs.Free;
@@ -842,6 +846,16 @@ implementation
         stringdispose(namespace);
         tcinitcode.free;
         tcinitcode:=nil;
+        localunitsearchpath.Free;
+        localunitsearchpath:=TSearchPathList.Create;
+        localobjectsearchpath.free;
+        localobjectsearchpath:=TSearchPathList.Create;
+        localincludesearchpath.free;
+        localincludesearchpath:=TSearchPathList.Create;
+        locallibrarysearchpath.free;
+        locallibrarysearchpath:=TSearchPathList.Create;
+        localframeworksearchpath.free;
+        localframeworksearchpath:=TSearchPathList.Create;
         moduleoptions:=[];
         is_dbginfo_written:=false;
         crc:=0;
tw28814-1.patch (1,276 bytes)   

Jonas Maebe

2016-07-05 20:41

manager   ~0093562

Could you try the attached patch instead?

Andrey Zubarev

2016-07-05 21:31

reporter   ~0093563

Not work((
Rewert two_problem_fix.patch, apply tw28814-1.patch
get the following

Hint: (11030) Start of reading config file E:\pp\bin\i386-win32\fpc.cfg
Hint: (11031) End of reading config file E:\pp\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 3.1.1 [2016/07/06] for i386
Copyright (c) 1993-2016 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
(3104) Compiling zcad.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawing.pas
(3104) Compiling .\zcad\core\drawings\uzcdrawings.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\core\undostack\zcmultiobjectcreateundocommand.pas
(3104) Compiling .\zcad\core\utils\uzcutils.pas
(3104) Compiling .\zcad\lclmod\uzctreenode.pas
E:\zcad\cad_source\.\zcad\lclmod\uzctreenode.pas(88,36) Warning: (3057) An inherited method is hidden by "constructor create(TComponent;TTranslateString;TTranslateString);"
(3104) Compiling .\zcad\gui\forms\uzcfcommandline.pas
(3104) Compiling .\zcad\uzcshared.pas
(3104) Compiling .\zcad\commands\uzccommandsmanager.pas
.\components\zcontainers\lib\i386-win32\gzctnrvectorpdata.ppu:gzctnrvectorpdata.pas(27,40) Note: (5071) Private type "GZVectorPData$2<UZCCOMMANDSABSTRACT.PCommandObjectDef,UZCCOMMANDSABSTRACT.CommandObjectDef>.TData" never used
(3104) Compiling .\zcad\lclmod\uzcinfoform.pas
(3104) Compiling .\zcad\entities\uzcenitiesvariablesextender.pas
(3104) Compiling .\zcad\core\undostack\zcobjectchangeundocommand.pas
Error: (1026) Compilation raised exception internally
Fatal: (1018) Compilation aborted
An unhandled exception occurred at $0043C356:
EAccessViolation: Access violation
  $0043C356 TMODULE__RESET, line 818 of fmodule.pas
  $0055F222 TPPUMODULE__RESET, line 170 of fppu.pas
  $0056354D TPPUMODULE__LOADPPU, line 1860 of fppu.pas
  $00563163 TPPUMODULE__RELOAD_FLAGGED_UNITS, line 1730 of fppu.pas
  $0056DEF8 PROC_UNIT, line 964 of pmodules.pas
  $0043D938 COMPILE, line 383 of parser.pas
  $00563885 TPPUMODULE__LOADPPU, line 1947 of fppu.pas
  $00562C39 TPPUMODULE__LOAD_USEDUNITS, line 1566 of fppu.pas
  $00563627 TPPUMODULE__LOADPPU, line 1892 of fppu.pas
  $0056CF40 LOADUNITS, line 501 of pmodules.pas
  $0056DCB0 PROC_UNIT, line 896 of pmodules.pas
  $0043D938 COMPILE, line 383 of parser.pas
  $00563885 TPPUMODULE__LOADPPU, line 1947 of fppu.pas
  $00562E8D TPPUMODULE__LOAD_USEDUNITS, line 1628 of fppu.pas
  $00563627 TPPUMODULE__LOADPPU, line 1892 of fppu.pas
  $00562C39 TPPUMODULE__LOAD_USEDUNITS, line 1566 of fppu.pas
  $00563627 TPPUMODULE__LOADPPU, line 1892 of fppu.pas

Error: E:\pp\bin\i386-win32\ppc386.exe returned an error exitcode

Jonas Maebe

2016-07-05 22:09

manager   ~0093567

Stupid mistake. What about this one?

Jonas Maebe

2016-07-05 22:10

manager  

tw28814-2.patch (1,318 bytes)   
diff --git a/compiler/fmodule.pas b/compiler/fmodule.pas
index 32d7a2c..515c51e 100644
--- a/compiler/fmodule.pas
+++ b/compiler/fmodule.pas
@@ -815,6 +815,11 @@ implementation
         resourcefiles:=TCmdStrList.Create;
         pendingspecializations.free;
         pendingspecializations:=tfphashobjectlist.create(false);
+        if assigned(waitingforunit) and
+          (waitingforunit.count<>0) then
+          internalerror(2016070501);
+        waitingforunit.free;
+        waitingforunit:=tfpobjectlist.create(false);;
         linkunitofiles.Free;
         linkunitofiles:=TLinkContainer.Create;
         linkunitstaticlibs.Free;
@@ -842,6 +847,16 @@ implementation
         stringdispose(namespace);
         tcinitcode.free;
         tcinitcode:=nil;
+        localunitsearchpath.Free;
+        localunitsearchpath:=TSearchPathList.Create;
+        localobjectsearchpath.free;
+        localobjectsearchpath:=TSearchPathList.Create;
+        localincludesearchpath.free;
+        localincludesearchpath:=TSearchPathList.Create;
+        locallibrarysearchpath.free;
+        locallibrarysearchpath:=TSearchPathList.Create;
+        localframeworksearchpath.free;
+        localframeworksearchpath:=TSearchPathList.Create;
         moduleoptions:=[];
         is_dbginfo_written:=false;
         crc:=0;
tw28814-2.patch (1,318 bytes)   

Andrey Zubarev

2016-07-05 22:34

reporter   ~0093569

Yes. It works

Jonas Maebe

2016-07-05 23:02

manager   ~0093570

Thanks for testing.

Andrey Zubarev

2016-07-05 23:05

reporter   ~0093571

Thanks!

Issue History

Date Modified Username Field Change
2015-10-09 17:51 Andrey Zubarev New Issue
2015-10-09 20:11 Thaddy de Koning Note Added: 0086400
2015-10-09 22:40 Jonas Maebe Note Added: 0086402
2015-10-09 22:40 Jonas Maebe Status new => resolved
2015-10-09 22:40 Jonas Maebe Resolution open => unable to reproduce
2015-10-09 22:40 Jonas Maebe Assigned To => Jonas Maebe
2015-10-10 20:49 Andrey Zubarev Note Added: 0086415
2015-10-10 20:49 Andrey Zubarev Status resolved => closed
2016-07-03 00:48 Andrey Zubarev Note Added: 0093495
2016-07-03 00:48 Andrey Zubarev Status closed => feedback
2016-07-03 00:48 Andrey Zubarev Resolution unable to reproduce => reopened
2016-07-03 09:57 Jonas Maebe Note Added: 0093496
2016-07-03 09:57 Jonas Maebe Status feedback => resolved
2016-07-03 09:57 Jonas Maebe Resolution reopened => unable to reproduce
2016-07-03 22:28 Andrey Zubarev Note Added: 0093517
2016-07-03 22:28 Andrey Zubarev Status resolved => feedback
2016-07-03 22:28 Andrey Zubarev Resolution unable to reproduce => reopened
2016-07-03 22:43 Jonas Maebe Assigned To Jonas Maebe =>
2016-07-03 22:43 Jonas Maebe Status feedback => new
2016-07-03 22:46 Andrey Zubarev Note Edited: 0093517 View Revisions
2016-07-04 19:36 Andrey Zubarev Note Added: 0093541
2016-07-05 00:22 Andrey Zubarev Note Added: 0093548
2016-07-05 00:23 Andrey Zubarev File Added: two_problem_fix.patch
2016-07-05 11:56 Jonas Maebe Note Added: 0093551
2016-07-05 20:41 Jonas Maebe File Added: tw28814-1.patch
2016-07-05 20:41 Jonas Maebe Note Added: 0093562
2016-07-05 21:31 Andrey Zubarev Note Added: 0093563
2016-07-05 22:09 Jonas Maebe File Added: tw28814-2.patch
2016-07-05 22:09 Jonas Maebe Note Added: 0093567
2016-07-05 22:10 Jonas Maebe File Deleted: tw28814-2.patch
2016-07-05 22:10 Jonas Maebe File Added: tw28814-2.patch
2016-07-05 22:10 Jonas Maebe File Deleted: tw28814-2.patch
2016-07-05 22:10 Jonas Maebe File Added: tw28814-2.patch
2016-07-05 22:34 Andrey Zubarev Note Added: 0093569
2016-07-05 23:02 Jonas Maebe Fixed in Revision => 34069
2016-07-05 23:02 Jonas Maebe Note Added: 0093570
2016-07-05 23:02 Jonas Maebe Status new => resolved
2016-07-05 23:02 Jonas Maebe Fixed in Version => 3.1.1
2016-07-05 23:02 Jonas Maebe Resolution reopened => fixed
2016-07-05 23:02 Jonas Maebe Assigned To => Jonas Maebe
2016-07-05 23:05 Andrey Zubarev Note Added: 0093571
2016-07-05 23:05 Andrey Zubarev Status resolved => closed