Bus error w/combined writeln(int) and uniform

Magnus Lie Hetland mlh at idi.ntnu.no
Sun Jan 30 10:40:11 PST 2011


On Jan 30, 2011, at 18:43 , Magnus Lie Hetland wrote:

> Tried to see if I could find this in the issue tracker; sorry if I  
> missed it. (Maybe it manifests with something other than a bus error  
> on other platforms?)
>
> Anyway, when I run the following program in OS X (using dmd 2.051),  
> it first prints out 1, and then I get a bus error:
>
> import std.random, std.stdio;
> void main() {
>    writeln(1);
>    auto y = uniform(0.0, 1.0);
> }


It seems like the whole writeln angle may be a red herring. In my  
current code I'm not using it at all. Yet now I suddenly got a  
segfault (i.e., no longer a bus error) while doing something totally  
innocuous. I commented out the call to uniform() elsewhere in my code  
(or, rather, replaced it with a constant float value), and the  
segfault went away...

-- 
Magnus Lie Hetland
http://hetland.org




More information about the Digitalmars-d mailing list