Segfault with DMD optimization switch
Jacob Carlborg
doob at me.com
Tue Jan 22 23:43:47 PST 2013
On 2013-01-22 19:21, Stephan wrote:
> 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.
I would say that if using the -O flag the code behaves differently from
without using the flag it's always a bug.
The -O flag should never change the semantic meaning of the code. It
should only make it faster.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list