View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0023724||FPC||FCL||public||2013-01-22 13:44||2013-01-27 12:26|
|Reporter||Assigned To||Sergei Gorelkin|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Platform||x64 (with x86 compiler)||OS||Windows|
|Target Version||2.7.1||Fixed in Version||3.0.0|
|Summary||0023724: Compilation error with fpcOPT -dTEST_WIN64_SEH|
|Description||Compiling 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
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 Reproduce||Run fpcup with - formatted for clarity; the --fpcOPT is probably the only relevant parameter:|
--fpcOPT="-gw -gl -dTEST_WIN64_SEH"
Presumably compiling by hand gives the same result.
|Additional Information||Originally reported on the forum; see http://lazarus.freepascal.org/index.php/topic,19631.msg111886.html#msg111886|
|Tags||No tags attached.|
|Fixed in Revision||23519|
How can you get r23487? I just svn up and get 23482 @.@
leledumbo@LeleBuntu:/media/Sources/lazarus-fpc$ svn info fpc
Working Copy Root Path: /media/Sources/lazarus-fpc/fpc
Repository Root: http://svn.freepascal.org/svn/fpc
Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2
Node Kind: directory
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...
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 for..in 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.
@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...
@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...
||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.|
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.
|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|
||Note Added: 0065082|
||Status||new => assigned|
||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|
||Status||resolved => closed|
||Fixed in Version||=> 2.7.1|