Bug 621 – When inside a loop, if you call break inside a try block the finally block is never executed
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-11-30T14:16:00Z
Last change time
2014-02-15T13:21:01Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
juanjo
Comments
Comment #0 by juanjo — 2006-11-30T14:16:28Z
This bug happens only on Linux. I've verified that it works with DMD on Windows. Here's a sample program that shows the bug:
import std.stdio;
int main(char[][] args)
{
while (true)
{
try
{
writefln("one");
break;
}
finally
{
// ERROR: This block is not executed
writefln("two");
}
}
writefln("three");
return 0;
}
Comment #1 by juanjo — 2006-11-30T14:20:02Z
The program should show the following output:
one
two
three
But on Linux you get:
one
three