[Issue 3930] AAs horribly broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 11 05:10:20 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3930


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-03-11 05:10:16 PST ---
I found the problem.  It has nothing to do with the cache, but it has to do
with a bug with how I store the length in the block.

Because I must store the length of a block that is page size or greater at the
front of the block (smaller blocks I store the length at the end), the start of
an array is offset by 2*size_t.sizeof bytes.

The problem comes when initializing a newly allocated array.  I forgot to add
the offset for larger arrays when calling memset, so the last 2*size_t.sizeof
bytes are not initialized.  In addition, if you allocated a large array of
structs which had a non-uniform initializer, they could all be skewed!

I think this fix is worth a new release of dmd.  I checked in the changes, but
druntime doesn't build at the moment, I think someone is adding stack tracing. 
Try this patch on your local copy of druntime and see if it fixes the problem
for you:
http://www.dsource.org/projects/druntime/changeset/261/trunk?format=diff&new=261

cc'ing walter to notify him.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list