Bug 5689 – [64-Bit] uniform() fails with -profile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-03-03T01:04:00Z
Last change time
2012-04-20T20:40:17Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
hoganmeier

Attachments

IDFilenameSummaryContent-TypeSize
1081floatUniform.dumpDisassembly from objdumpapplication/octet-stream905187

Comments

Comment #0 by hoganmeier — 2011-03-03T01:04:42Z
import std.random; void main() { auto f = uniform(0.0, 1.0); } $ dmd -m64 -profile profile.d $ ./profile object.Exception@dmd/linux/bin/../../src/phobos/std/random.d(932): Invalid distribution range: [0, 0) ---------------- Compiling it without -profile or m64 works.
Comment #1 by hoganmeier — 2011-08-07T17:37:49Z
Another case: import std.random; void main() { double r1=2*uniform(0.0, 1.0); double r2=2*uniform(0.0, 1.0); } It only fails if both declarations are present. invalid bounding interval [7.69602e+169, -nan) btw, if -inline is added, it yields: invalid bounding interval [7.29112e-304, 1.12477e+218)
Comment #2 by code — 2012-03-15T13:52:38Z
I can't reproduce this. What are your compiler version and parameters.
Comment #3 by hoganmeier — 2012-03-15T14:03:28Z
With git dmd on Ubuntu 11.04 it's now: $ dmd -m64 -profile test.d $ ./test object.Exception@std/random.d(940): std.random.uniform(): invalid bounding interval [1.42645e+242, 1.62687e+219)
Comment #4 by james — 2012-03-15T20:14:01Z
Floating point causes incorrect values, no errors, reduced down to this code: import std.random : uniform; void main() { uniform(0.0f, 1.0f); } uniform returns values around 1.4203e+31
Comment #5 by james — 2012-03-15T20:17:22Z
Created attachment 1081 Disassembly from objdump
Comment #6 by code — 2012-03-16T13:24:14Z
Comment #7 by github-bugzilla — 2012-03-21T00:04:58Z
Comment #8 by github-bugzilla — 2012-04-20T20:40:17Z