Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 24, 2006 Big bug with scope() in nested { } | ||||
---|---|---|---|---|
| ||||
This *is* a bug. Has it been reported yet? <code> import std.stdio; void main() { { scope(exit) writef("a\n"); } scope(exit) writef("b\n"); } <code> output: a b b |
September 24, 2006 Re: Big bug with scope() in nested { } | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | forgot to mention DMD 0.164 linux |
September 24, 2006 Re: Big bug with scope() in nested { } | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote: > This *is* a bug. Has it been reported yet? > > <code> > import std.stdio; > > void main() > { > { > scope(exit) writef("a\n"); > } > > scope(exit) writef("b\n"); > } > <code> > > output: > > a > b > b Probably a new discovery. This is related to the try-catch bug that has been around since DMD 0.150. So far, no fix. Here are the relevant posts: http://lists.puremagic.com/pipermail/digitalmars-d-bugs/2006-May/000854.html http://lists.puremagic.com/pipermail/digitalmars-d-bugs/2006-August/001911.html Hopefully they will get fixed soon. |
September 24, 2006 Re: Big bug with scope() in nested { } | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mikola Lysenko | == Quote from Mikola Lysenko (mclysenk@mtu.edu)'s article
> Probably a new discovery. This is related to the try-catch bug that has been around since DMD 0.150. So far, no fix. Here are the relevant posts:
>
>http://lists.puremagic.com/pipermail/digitalmars-d-bugs/2006-May/000854.html
>
>http://lists.puremagic.com/pipermail/digitalmars-d-bugs/2006-August/001911.html
> Hopefully they will get fixed soon.
Likely this is related, but both of them only mention cases where delegates are used, How does mine create a delegate? (From the scope statement?) OTOH is this bug known to cause problems elsewhere? (I didn't read then whole thread)
|
September 25, 2006 Re: Big bug with scope() in nested { } | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote:
> Likely this is related, but both of them only mention cases where delegates are
> used, How does mine create a delegate? (From the scope statement?) OTOH is this
> bug known to cause problems elsewhere? (I didn't read then whole thread)
>
From what I've worked out, it appears to be an issue with the way the compiler calculates offsets for things like catch and finally blocks in general. The delegates are just one case of this bug. Whenever there is more than one set of scope exit blocks, the bug will manifest.
It appears to be because the compiler does not properly compute the offsets in one of the DHandler structs (though the exact details escape me at the moment, since it has been a few months since I spent any time wrestling with this problem.) It is a rather aggravating problem, which took me several hours of single stepping through the asm from deh2.d to figure out what was going.
I certainly hope it gets fixed in the next release.
|
Copyright © 1999-2021 by the D Language Foundation