View Issue Details

IDProjectCategoryView StatusLast Update
0036544FPCCompilerpublic2020-01-10 16:40
ReporterJoost van der SluisAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86OSWindowsOS Version
Product Version3.3.1Product Build 
Target Version3.2.0Fixed in Version3.3.1 
Summary0036544: Exceptions during the initialization of units are 'eaten' (with SEH-based exeptions)
DescriptionWhen an exception is raised during/in the initialization-section/phase of a unit within a library, the application is killed immediately. The exception is not shown or handled.

This only happens when SEH-excaptions are enabled, on win64 and win32.
Steps To ReproduceWhen the library below is used in an application. the application is killed immediately (The exception anr/or the stacktrace are not shown)

{$mode objfpc}
library tw9999a;
uses
  tw9999b;
procedure library_procedure;
begin
  writeln('Not ok');
end;
exports library_procedure;
begin
end.



{$mode objfpc}
unit tw9999b;
interface
uses
  sysutils;
implementation
initialization
  raise Exception.Create('One should see this exception.');
end.
Additional InformationMy guess is that one of the exception-frames is missing, so that the call to kernel32.dll's RaiseException ends up in a call to RaiseFailFastException. The backtrace looks as follows:

gdb: unknown target exception 0xe0465043 at 0x75fe35d2

Program received signal ?, Unknown signal.
0x75fe35d2 in RaiseFailFastException () from C:\WINDOWS\SysWOW64\KernelBase.dll
(gdb) bt
#0 0x75fe35d2 in RaiseFailFastException () from C:\WINDOWS\SysWOW64\KernelBase.dll
0000001 0x1000fa7f in fpc_raiseexception () from C:\tmp\SEHTests\tw9999a.dll
0000002 0x10010465 in TW9999B_$$_init$ () at tw9999b.pp:13
0000003 0x10009d0a in fpc_initializeunits () from C:\tmp\SEHTests\tw9999a.dll
0000004 0x10009d46 in fpc_libinitializeunits () from C:\tmp\SEHTests\tw9999a.dll
0000005 0x10001628 in P$TW9999A_$$_main () at tw9999a.pp:16
TagsNo tags attached.
Fixed in Revision43901
FPCOldBugId
FPCTarget-
Attached Files
  • tw9999a.pp (279 bytes)
    { %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos,aix,android,haiku }
    { %norun }
    { %needlibrary }
    {$mode objfpc}
    library tw9999a;
    
    uses
      tw9999b;
    
    procedure library_procedure;
    begin
      writeln('Not ok');
    end;
    
    exports library_procedure;
    
    begin
    end.
    
    tw9999a.pp (279 bytes)
  • tw9999b.ppu (847 bytes)
  • tw9999c.pp (239 bytes)
    { %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos,aix,android,haiku }
    { %needlibrary }
    {$mode objfpc}
    
    uses
      sysutils;
    
    {$linklib tw9999a}
    
    procedure library_procedure; external;
    
    begin
      library_procedure;
    end.
    
    tw9999c.pp (239 bytes)

Activities

Joost van der Sluis

2020-01-09 22:38

manager  

tw9999a.pp (279 bytes)
{ %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos,aix,android,haiku }
{ %norun }
{ %needlibrary }
{$mode objfpc}
library tw9999a;

uses
  tw9999b;

procedure library_procedure;
begin
  writeln('Not ok');
end;

exports library_procedure;

begin
end.
tw9999a.pp (279 bytes)
tw9999b.ppu (847 bytes)
tw9999c.pp (239 bytes)
{ %target=win32,win64,wince,darwin,linux,freebsd,solaris,beos,aix,android,haiku }
{ %needlibrary }
{$mode objfpc}

uses
  sysutils;

{$linklib tw9999a}

procedure library_procedure; external;

begin
  library_procedure;
end.
tw9999c.pp (239 bytes)

Sven Barth

2020-01-10 16:40

manager   ~0120310

Please test and close if okay. (Btw: you uploaded a PPU ;) )

Issue History

Date Modified Username Field Change
2020-01-09 22:38 Joost van der Sluis New Issue
2020-01-09 22:38 Joost van der Sluis File Added: tw9999a.pp
2020-01-09 22:38 Joost van der Sluis File Added: tw9999b.ppu
2020-01-09 22:38 Joost van der Sluis File Added: tw9999c.pp
2020-01-10 15:44 Sven Barth Assigned To => Sven Barth
2020-01-10 15:44 Sven Barth Status new => assigned
2020-01-10 16:40 Sven Barth Status assigned => resolved
2020-01-10 16:40 Sven Barth Resolution open => fixed
2020-01-10 16:40 Sven Barth Fixed in Version => 3.3.1
2020-01-10 16:40 Sven Barth Fixed in Revision => 43901
2020-01-10 16:40 Sven Barth FPCTarget => -
2020-01-10 16:40 Sven Barth Note Added: 0120310