[fpc-devel] Access violation during compilation

Marco van de Voort marcov at stack.nl
Thu Jan 19 12:14:57 CET 2012

In our previous episode, kyan said:
> Compiling unit1.pas
> Compiling C:\Projects\MkCtrls\PropStorage.pas
> Compiling C:\Projects\MkCtrls\UHom.pas
> Compiling C:\Projects\MkCtrls\uHomXPath.pas
> Fatal: Compilation aborted
> An unhandled exception occurred at $0000000100042D3C:
> EAccessViolation: Access violation
>   $0000000100042D3C
>   $0000000100120431
>   $000000010011EC8B
>   $0000000100121075
>   $000000010012109C
>   $000000010012109C
>   $000000010012109C
>   $0000000100121DFB
>   $000000010010CC45
>   $0000000100109CF8
>   $000000010010C68B
>   $000000010010CC75
>   $0000000100107BF4
>   $0000000100107A39
>   $000000010003D596
>   $000000010014759E
>   $00000001001520A1
> It seems that the compiler itself throws an AV. I am trying to isolate
> the code structure that causes this AV so that I can rewrite it or
> report a bug but I haven't been able to do it so far because the
> involved units are quite complex and depend on each other and other
> units heavily.

That is still the way to go. It is not terribly difficult but can be
overwhelming the first times. Just push yourself through after a few times
it gets easier.

There are some tricks to help though:

- increase verbosity (-va) from this log you can sometimes find out where
  the crash happens
- inserting errors in the relevant unit by inserting random characters in
  a binary search program (if the compiler errors on the "XXX" that I
  inserted, then that spot is before the crash, ok, now lets move the
  XXX a bit further into the unit)
- recompiling the compiler with lineinfo (-gl, -gw, don't know if that works
  for win64 atm), the traceback might give you an idea which language
  feature causes the crash.

More information about the fpc-devel mailing list