Segfault with DMD optimization switch

Stephan stephan80 at mac.com
Tue Jan 22 10:21:33 PST 2013


Hi,

I just spent the last 5 hours trying to find the cause of a 
segmentation fault. It was clearly my mistake that I did all 
those tests with dmd's optimization switch on ("-O").
When I disabled optimization, i.e. removed the "-O" flag, the 
code runs perfectly.

I can't exclude an actual bug in my code with 100 percent 
certainty. But given various segmentation faults that I have seen 
with dmd previous to version 2.061, and given the fact that I am 
not using any pointers or other memory-unsafe constructs, I am 
inclined to believe that this segfault is actually caused by dmd 
itself, or at least dmd's optimization. Please correct me if you 
think that is extremely unlikely.

Has anyone experienced those kind of problems which only occur 
with the "-O" flag, but not without it? Or can anyone point me to 
a related bug that has already been reported on bugzilla?

Unfortunately, in my case the code crashed in a position late in 
some iteration loop, so I can't easily reproduce it in a simple 
program to file a bug report.

Stephan


More information about the Digitalmars-d mailing list