Is it a Bug?

Chris R. Miller lordSaurontheGreat at gmail.com
Wed Aug 6 01:25:43 PDT 2008


Vladimir Panteleev wrote:
> On Wed, 06 Aug 2008 08:29:44 +0300, Chris R. Miller 
> <lordSaurontheGreat at gmail.com> wrote:
> 
>> I have code which runs when built by GDC on OS X, but fails
>> spectacularly on DMD 1.030 and 1.033 on Windows.  I'm not sure what to
>> think, since DDBG isn't working well enough to import the rest of the
>> source files to unroll the stack far enough for me to find the offending
>> line and work around it.
> 
> Here's your bug:
> 
> 16        this(bool n,MapCoord[] p...){
> 17            Normalized=n;
> 18            Points=p;
> 19        }
> 
> DMD allocates variadic parameter arrays on the stack, so "p" (and 
> "Points") contain a slice of memory on the stack.
> 
> Change line 18 to "Points=p.dup;" and it'll work.

Wow, I didn't remember that.  Thanks, I probably would not have caught 
that bug if left to my own devices.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080806/e06a7963/attachment.pgp>


More information about the Digitalmars-d mailing list