Exception handling crashes 32-bit app running under Win7 64-bit (SEH needed in windows handlers?)
Original Reporter info from Mantis: th1975
-
Reporter name: Tassilo
Original Reporter info from Mantis: th1975
- Reporter name: Tassilo
Description:
Situation:
Used IDE/compiler:
Lazarus 2.0.0r60307 for Windows 32-bit with FPC 3.0.4, and
Lazarus 2.0.0r60307 for Windows 64-bit with FPC 3.0.4,
(both installed in Windows 7 64-bit virtual machine (Parallels/MacOS))
Code causes a system exception/signal (e.g. a FPU exception, or an integer divide-by-zero, or access violation).
The exception is immediately caught:
try
i:=1; j:=0;
i:=i div j;
except
on e: EDivByZero do begin
ShowMessage('i:=i div j raised exception '+e.Message);
end;
end;
Compiled with Lazarus-FPC/Win32 (under Win7/64) as Win32-executable, the application crashes if executed under Win7/64bit, but works as expected (shows dialog) under WinXP/32bit.
The same code, compiled with Lazarus-FPC/Win64 (also under Win7/64) as Win64-executable, works fine under Win7/64bit.
The problem does NOT occurr for software-generated exceptions, these are properly caught in all cases:
try
raise Exception.Create('Stupid test exception');
except
on e: Exception do ShowMessage('Exception: '+e.Message);
end;
This always shows the dialog, regardless if compiled as 32-bit or 64-bit executable under Win7/64.
Steps to reproduce:
Open attached Lazarus project and compile as Windows 32-bit application. Run under Windows 7/64-bit. Click Button 1, 3 or 4 and the application crashes. Click button 2 and the message dialog pops up as desired.
Mantis conversion info:
- Mantis ID: 35462
- OS: Win 7 64bit / Win XP 32bit
- OS Build: div.
- Platform: diverse
- Version: 3.0.4
- Monitored by: » th1975 (Tassilo), » @martin_frb (Martin Friebe)