www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - data corruption

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
Hey folks,

I've got this screwy problem with my old version of dmdz.

One of the functions runs through a loop that appends to a string[] 
about four or five times. When it's chewing through a large amount of 
source code, maybe 1 call out of 200 the third element of the array gets 
corrupted just after an append.

duping the string that gets appended has no effect.

Trying to print out the pointer addresses to the strings does seem to 
get rid of the problem.

I'm using dmd 2.042; it doesn't seem to happen on 2.040
Apr 05 2010
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Ellery Newcomer wrote:
 I've got this screwy problem with my old version of dmdz.
 
 One of the functions runs through a loop that appends to a string[] 
 about four or five times. When it's chewing through a large amount of 
 source code, maybe 1 call out of 200 the third element of the array gets 
 corrupted just after an append.
 
 duping the string that gets appended has no effect.
 
 Trying to print out the pointer addresses to the strings does seem to 
 get rid of the problem.
 
 I'm using dmd 2.042; it doesn't seem to happen on 2.040
If you can turn this into a standalone reproducible test case, please do so and put it on bugzilla. Memory corruption problems are the worst, so doing this would be a big help.
Apr 06 2010
prev sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Mon, 05 Apr 2010 20:06:30 -0400, Ellery Newcomer  
<ellery-newcomer utulsa.edu> wrote:

 Hey folks,

 I've got this screwy problem with my old version of dmdz.

 One of the functions runs through a loop that appends to a string[]  
 about four or five times. When it's chewing through a large amount of  
 source code, maybe 1 call out of 200 the third element of the array gets  
 corrupted just after an append.

 duping the string that gets appended has no effect.

 Trying to print out the pointer addresses to the strings does seem to  
 get rid of the problem.

 I'm using dmd 2.042; it doesn't seem to happen on 2.040
Others have seen similar issues, can you email me directly, and perhaps we can get to the bottom of it? We had memory corruption issues I introduced with my array append patch in 2.041, and I thought I squashed them all, but I should be able to find the bug reasonably quickly if I have a reproducible test case. Thanks, -Steve
Apr 06 2010
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Tue, 06 Apr 2010 08:12:55 -0400, Steven Schveighoffer  
<schveiguy yahoo.com> wrote:

 On Mon, 05 Apr 2010 20:06:30 -0400, Ellery Newcomer  
 <ellery-newcomer utulsa.edu> wrote:

 Hey folks,

 I've got this screwy problem with my old version of dmdz.

 One of the functions runs through a loop that appends to a string[]  
 about four or five times. When it's chewing through a large amount of  
 source code, maybe 1 call out of 200 the third element of the array  
 gets corrupted just after an append.

 duping the string that gets appended has no effect.

 Trying to print out the pointer addresses to the strings does seem to  
 get rid of the problem.

 I'm using dmd 2.042; it doesn't seem to happen on 2.040
Others have seen similar issues, can you email me directly, and perhaps we can get to the bottom of it? We had memory corruption issues I introduced with my array append patch in 2.041, and I thought I squashed them all, but I should be able to find the bug reasonably quickly if I have a reproducible test case.
Thanks to Ellery's help, I found another bug in the new array append code that can corrupt memory in certain cases. If any of you need this fix right away and are comfortable rebuilding druntime and phobos, the patch can be found here: http://www.dsource.org/projects/druntime/changeset/282?format=diff&new=282 You may have to tweak things a bit to get the patch to work, or you can just make the changes yourself (they are quite small). For instance, I had to change the file to unix file format to get the patch applied on linux. I expect a new dmd will be released in the near future to fix this issue. My apologies to those who have wasted time trying to debug this... -Steve
Apr 06 2010
parent Jordi <jordi rovira.cat> writes:
Steven Schveighoffer wrote:

 I expect a new dmd will be released in the near future to fix this 
 issue.  My apologies to those who have wasted time trying to debug this...
 
 -Steve
I confirm that with the patch in dmd 2.0.43 my crash problem is gone. Thanks for the fix and the test case! j.
Apr 09 2010