Forum > Windows

[Fixed] FPC 3.0.4 Compilation exception (fatal 1018)

(1/8) > >>

When I build a project it all works. Then I make a small change and even revert the change and select to compile. The compilation is aborted because of the problem below.
(I used lazbuild from the command line to get the exception because Lazarus hides it)

It must be some bug in the FPC compiler but not sure how to deal with this and would like to help to get this resolved.

Free Pascal Compiler version 3.0.4 [2018/02/25] for i386
Copyright (c) 1993-2017 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
(3104) Compiling SimpleObjectsTest.dpr
(3104) Compiling SimpleObjects.pas
C:\Repository\mail_server\Components\Lib\tests\SimpleObjectsTest\SimpleObjects.pas(207,9) Warning: (5043) Symbol "Resume" is deprecated
Fatal: (1018) Compilation aborted
An unhandled exception occurred at $0044EFB6:
EAccessViolation: Access violation

Error: C:\lazarus\fpc\3.0.4\bin\i386-win32\ppc386.exe returned an error exitcode
Error: (lazarus) Compile Project, Mode: Windows, Target: SimpleObjectsTest.exe: stopped with exit code 1
Error: (lazbuild) failed compiling of project C:\Repository\mail_server\Components\Lib\tests\SimpleObjectsTest\SimpleObjectsTest.lpi

Hallo jakubklos,
Welcome to the  forum.

Simply showing your issue isn't very useful for us to be able to help you fixing the problem. You should provide more information like the source code or the steps to reproduce the issue, etc.

Have you tried to remove the lib folder? I sometimes get 'weird' compilation result but it can be solved if I delete the lib folder and recompile again.

Hi Handoko
than you for your response.

Deleting the lib folder helps of course because it is the same as building the project. That works but after a change (possible only a time stamp modification of one unit file) the compilation breaks.

It is a huge project so I cannot share it easily. I was mainly asking for some guidelines to how debug / troubleshoot this.
Currently I am thinking about compiling the compiler with debug information so I get the stack of the error with line numbers and function names.
Nothing else comes to my mind.

Thank you

Which mode are you using? ObjFpc or Delphi mode?
I have seen this in more than one question and usually you need to change the mode (for that specific unit).
It often is caused by implicit procedural pointers (as in mode delphi) as opposed to explicit procedural pointers (that need @) in mode ObjFpc.

If you mix them up you'll get e.g. @@, a (pointer to a pointer to a reference)  instead, which does kaboom! a.k.a your 1018.

I gave it some time and was able to filter all the required units from the big project to reproduce this issue.
It is only 3 units now. I am attaching the project.


1. Open the lpi project in Lazarus
2. Open the TestUnit.pas
3. Compile
so far so good
4. Make a change in the TestUnit.pas (add something to fail a compilation like "aaaa"). Compile. It fails. Now revert the added text and compile again.
It should compile properly but does not. Instead if fails with the exception in my original post.

- If you comment out the TTestDataCollection definition in the TestUnit.pas it can compile without building
- If you make a change in the ListUnit (when the issue occurs) then again it can compile just fine because this unit gets recompiled

As you can see you cannot really use this in production because after any change you must rebuild the whole project.
Please, let me know what else to do

Thank you


[0] Message Index

[#] Next page

Go to full version