View Issue Details

IDProjectCategoryView StatusLast Update
0023724FPCFCLpublic2013-01-27 12:26
ReporterReinier OlislagersAssigned ToSergei Gorelkin  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformx64 (with x86 compiler)OSWindows 
Product Version2.7.1 
Target Version2.7.1Fixed in Version3.0.0 
Summary0023724: Compilation error with fpcOPT -dTEST_WIN64_SEH
DescriptionCompiling trunk r23487 with fpcup and fpcOPT -dTEST_WIN64_SEH gives a compilation error (see below)
Compiling without -dTEST_WIN64_SEH gives no problems

The installer encountered the following error:
External command "C:/development/fpctrunk/compiler/ppcx64.exe -Twin64 -FUfcl-stl
\units\x86_64-win64\ -FuC:\development\fpctrunk\rtl\units\x86_64-win64\ -Fufcl-s
tl\src -Ur -Xs -O2 -n -FuC:/development/fpctrunk/rtl/units/x86_64-win64 -gw -gl
-dTEST_WIN64_SEH -dx86_64 -dRELEASE -S2h -viq fcl-stl\BuildUnit_fcl_stl.pp" fail
ed with exit code 1. Console output:
Target OS: Win64 for x64
Compiling fcl-stl\BuildUnit_fcl_stl.pp
Compiling .\fcl-stl\src\garrayutils.pp
Compiling .\fcl-stl\src\gdeque.pp
Compiling .\fcl-stl\src\gset.pp
Compiling .\fcl-stl\src\gmap.pp
Compiling .\fcl-stl\src\gvector.pp
Compiling .\fcl-stl\src\gpriorityqueue.pp
Compiling .\fcl-stl\src\gqueue.pp
Compiling .\fcl-stl\src\gtree.pp
Compiling .\fcl-stl\src\gstack.pp
gtree.pp(88,4) Error: Generic methods cannot have nested procedures
gtree.pp(118,4) Error: Generic methods cannot have nested procedures
gtree.pp(136,4) Error: Generic methods cannot have nested procedures
gtree.pp(140) Fatal: There were 3 errors compiling module, stopping
Fatal: Compilation aborted
Steps To ReproduceRun fpcup with - formatted for clarity; the --fpcOPT is probably the only relevant parameter:
--fpcOPT="-gw -gl -dTEST_WIN64_SEH"
--lazOPT="-gw -gl"

Presumably compiling by hand gives the same result.
Additional InformationOriginally reported on the forum; see,19631.msg111886.html#msg111886
TagsNo tags attached.
Fixed in Revision23519
Attached Files


Mario Ray Mahardhika

2013-01-22 15:59

reporter   ~0065080

How can you get r23487? I just svn up and get 23482 @.@

leledumbo@LeleBuntu:/media/Sources/lazarus-fpc$ svn info fpc
Path: fpc
Working Copy Root Path: /media/Sources/lazarus-fpc/fpc
Repository Root:
Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2
Revision: 23491
Node Kind: directory
Schedule: normal
Last Changed Author: sergei
Last Changed Rev: 23482
Last Changed Date: 2013-01-22 00:16:15 +0700 (Tue, 22 Jan 2013)

gtree can be either compiled manually or by the make here. Anyway, the error locations look suspicious as it's on the end of "end" keyword...

Sergei Gorelkin

2013-01-22 16:33

developer   ~0065081

Last edited: 2013-01-22 16:50

Indeed, compiling with TEST_WIN64_SEH causes finalization code (including implicit finalization) to be put into separate hidden procedures which behave a lot like nested procedures. The procedures where errors are reported contain implicit finalization due to loops (enumerator object is disposed in finally block).

The check forbidding nested procedures for generic methods probably needs to be relaxed to allow SEH finalization procedures. These can be distinguished by procdef.proctypeoption=potype_exceptfilter.

upd: As I understand, the issue is caused by adding the gtree unit in r23453. Before that, there weren't any generic methods with finalization code in the sources.

Reinier Olislagers

2013-01-22 18:22

developer   ~0065082

@Leledumbo: I quoted the repo revision, not the branch revision. Shouldn't matter in practice, I think.

@Sven, I've taken the liberty to assign it to you, as I'm assuming you're the one best suited to fix it...

Sven Barth

2013-01-24 07:59

manager   ~0065109

Last edited: 2013-01-24 08:00

@Sergei: Could you please disable the generation of these finalization procedures if "parse_generic" is true? The surrounding method can not be called anyway (no code will be generated), so it's not necessary to generate these procedures. If disabling the generation would need adjustments in other code parts I suppose you can try to relax the nested procedures check instead...
I would do it myself, but today and tomorrow I'm busy with university stuff and I'd also need to find the corresponding locations first...


Sergei Gorelkin

2013-01-24 15:30

developer   ~0065126

I also need to study what exactly is happening at parsing time, because finalization procedures should be generated only during firstpass. I will address this issue during weekend.

Sergei Gorelkin

2013-01-25 19:56

developer   ~0065162

Well, they should be created in firstpass, but are actually created in constructor. Disabling for generic methods makes fcl-stl package compile successfully.

Please test and close if ok.

Issue History

Date Modified Username Field Change
2013-01-22 13:44 Reinier Olislagers New Issue
2013-01-22 13:44 Reinier Olislagers FPCOldBugId => 0
2013-01-22 15:59 Mario Ray Mahardhika Note Added: 0065080
2013-01-22 16:33 Sergei Gorelkin Note Added: 0065081
2013-01-22 16:50 Sergei Gorelkin Note Edited: 0065081
2013-01-22 18:22 Reinier Olislagers Note Added: 0065082
2013-01-22 18:22 Reinier Olislagers Status new => assigned
2013-01-22 18:22 Reinier Olislagers Assigned To => Sven Barth
2013-01-24 07:59 Sven Barth Assigned To Sven Barth => Sergei Gorelkin
2013-01-24 07:59 Sven Barth Note Added: 0065109
2013-01-24 08:00 Sven Barth Note Edited: 0065109
2013-01-24 15:30 Sergei Gorelkin Note Added: 0065126
2013-01-25 19:56 Sergei Gorelkin Fixed in Revision => 23519
2013-01-25 19:56 Sergei Gorelkin Status assigned => resolved
2013-01-25 19:56 Sergei Gorelkin Resolution open => fixed
2013-01-25 19:56 Sergei Gorelkin Note Added: 0065162
2013-01-27 12:26 Reinier Olislagers Status resolved => closed
2013-01-27 12:26 Reinier Olislagers Fixed in Version => 2.7.1