Exceptions on Windows being "swallowed"
Rainer Schuetze
r.sagitario at gmx.de
Wed Nov 27 07:12:19 UTC 2019
On 27/11/2019 06:55, cartland wrote:
> On Wednesday, 27 November 2019 at 05:43:33 UTC, Mike Parker wrote:
>> On Wednesday, 27 November 2019 at 05:15:10 UTC, cartland wrote:
>> *snip*
>>
>> dmd -m32mscoff -debug -g x.d
>>
>> And see what happens.
>
> No difference between "dmd -m32mscoff -debug -g x.d" and "dmd -m32mscoff
> x.d"
>
> --------
> C:\tmp\x>dmd -m32mscoff -debug -g x.d
>
> C:\tmp\x>x
> hello
>
> C:\tmp\x>dmd x.d
>
> C:\tmp\x>x
> hello
> finally
> catch first
> done
> ----------
>
> x.d contents
> --------
> import std.stdio;
> void main() {
> writeln("hello");
> try {
> try {
> throw new Exception("first");
> } finally{
> writeln("finally");
> throw new Exception("second");
> }
> } catch (Exception e) {
> writeln("catch ", e.msg);
> }
> writeln("done");
> }
> -----------
>
In a debugger, I get:
Unhandled exception at 0x004010EF in x.exe: 0xC00001A5: An invalid
exception handler routine has been detected (parameters: 0x00000001).
This seems to happen when lld is used instead of the Microsoft linker.
Maybe related: https://bugs.llvm.org/show_bug.cgi?id=42221
Using lld from LLVM 9 spits out errors "not compatible with SEH", but
links using /SAFESEH:NO. The resulting executable then works.
I have created an issue: https://issues.dlang.org/show_bug.cgi?id=20421
More information about the Digitalmars-d-learn
mailing list