[fpc-pascal] Compiler hangs while generating debug information

Nitorami mneubauer at alice-dsl.net
Thu Jan 11 18:46:54 CET 2018

I encountered an odd problem, however reliably reproducible under both
windows 7 and 10, 32bit, with FPC 3.0.2 and 3.0.4. (NOT with Lazarus 1.6.4
which uses FPC 3.0.2 but 64bit)

When compiling my program with debug info using fpc -B -g, the compiler
hangs just before generating the exe file. It seems to get into an endless
loop while assembling the debug information. When compiling without debug
info, or in dwarf format (fpc -B -gw), the issue does not appear, and the
code compiles properly. 

The individual units also compile ok. The issue only appears when compiling
the entire program, or at least the highest level unit.

"Hangs" means no reaction for >5 minutes while normally the code compiles in
2 seconds.

I am not using generics.

The issue does not depend on any compiler settings, except debug information
/ format. 

My source code is correct and working properly when compiled with nodebug;
it just happens to throw the compiler into an endless loop by some remote
combination of factors. The freeze may disappear or reoccur when changing
parts of the code but the causal factors are entirely intransparent to me,
and I did not manage to strip the program down to a small piece of code
which still causes the problem.

Personally I can use nodebug as workaround, that's fine, but I think the
issue should be fixed in the compiler. I am uncertain whether I should
submit this as a bug report; I would have to submit all source code as far
as necessary to reproduce the problem, in case anybody is willing to look
into it. It is approx. 8 units with 4000 lines of code. I don't think one
would have to understand the code, it is rather an issue of running the
compiler in a debugging environment while it tries to compile. That is
beyond my own skills.
Any opinions ?

Sent from: http://free-pascal-general.1045716.n5.nabble.com/

More information about the fpc-pascal mailing list