Bug 8671 – Segmentation fault with 1.0 - uniform(0.0, 1.0)

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2012-09-16T13:15:16Z
Last change time
2021-08-25T13:01:53Z
Assigned to
No Owner
Creator
Peter Alexander

Comments

Comment #0 by peter.alexander.au — 2012-09-16T13:15:16Z
This program segfaults on OSX 10.6.8 with DMD 2.060. Happens with both -m32 and -m64. import std.random; void main() { double t = 1.0 - uniform(0.0, 1.0); } Here's the result of running gdb: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address: 0x0000000000000000 0x00007fff89c44fc1 in dyld_stub_binder () (gdb) bt #0 0x00007fff89c44fc1 in dyld_stub_binder () #1 0x00000001000292e8 in pvars () #2 0x00000001000224f5 in D3std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine20__T12__lambda1190TiZ12__lambda1190FiZk () #3 0x000000010002249d in D3std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine225__T9MapResultS1733std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine12__lambda1190TS3std5range13__T6RepeatTiZ6RepeatZ9MapResult5frontMFNdZk () #4 0x0000000100026b66 in D3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine408__T4seedTS3std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine225__T9MapResultS1733std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine12__lambda1190TS3std5range13__T6RepeatTiZ6RepeatZ9MapResultZ4seedMFS3std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine225__T9MapResultS1733std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine12__lambda1190TS3std5range13__T6RepeatTiZ6RepeatZ9MapResultZv () #5 0x00000001000265e3 in D3std6random6rndGenFNcNdZS3std6random98__T21MersenneTwisterEngineTkVi32Vi624Vi397Vi31Vk2567483615Vi11Vi7Vk2636928640Vi15Vk4022730752Vi18Z21MersenneTwisterEngine () #6 0x0000000100000fa5 in D3std6random27__T7uniformVAyaa2_5b29TdTdZ7uniformFddZd () at /Library/Compilers/dmd2/osx/bin/../../src/phobos/std/random.d:1106 #7 0x0000000100000cfa in _Dmain () at p394.d:32 #8 0x000000010001b732 in D2rt6dmain24mainUiPPaZi7runMainMFZv () #9 0x000000010001b0e9 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv () #10 0x000000010001b77c in D2rt6dmain24mainUiPPaZi6runAllMFZv () #11 0x000000010001b0e9 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv () #12 0x000000010001b073 in main () #13 0x0000000100000cb4 in start ()
Comment #1 by peter.alexander.au — 2012-09-16T13:39:41Z
Still occurs in git HEAD as of the time of this post.
Comment #2 by hsteoh — 2014-09-24T18:57:09Z
Doesn't happen on Linux/64 with DMD git HEAD. Will try to test OSX on the autotester next...
Comment #3 by hsteoh — 2014-09-24T22:13:29Z
Hmm. This seems to work now on git HEAD (all tested platforms), according to the autotester for this testing pull: https://github.com/D-Programming-Language/dmd/pull/4023
Comment #4 by peter.alexander.au — 2014-09-24T22:52:19Z
Yep, works for me too now. Thanks for following this one up, I forgot about it ^_^
Comment #5 by hsteoh — 2014-09-24T23:30:54Z
No prob, I'm just going through old bugs looking for low-hanging fruit. :-) I have a few set queries setup to find 1-2 year old bugs and 2-10 year old bugs, so that I can look at bugs with various levels of negligence to find easy fixes. :-P
Comment #6 by github-bugzilla — 2014-09-25T00:33:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f4a86d7a8d017e5348ec730960e48aef255f45a9 Add test case for issue 8671. https://github.com/D-Programming-Language/dmd/commit/6cf07a72b505615e207a5bf0ca5e0003f031ef87 Merge pull request #4023 from quickfur/issue8671 Issue 8671: Add test case for worksforme issue 8671.
Comment #7 by github-bugzilla — 2015-02-18T03:37:27Z
Comment #8 by dlang-bot — 2021-08-25T12:24:27Z
dlang/phobos pull request #8209 "std.random: Add test for Issue 8671" was merged into master: - d5676dd5343ee33fd81348713f03a082643a414e by Iain Buclaw: std.random: Add test for Issue 8671 https://github.com/dlang/phobos/pull/8209
Comment #9 by dlang-bot — 2021-08-25T13:01:53Z
dlang/dmd pull request #13013 "test: Remove test case for issue 8671" was merged into master: - 5674c4fa3e8c70320c0f636c46660de49f61e86f by Iain Buclaw: test: Remove test case for issue 8671 This has been moved to std.random in Phobos https://github.com/dlang/dmd/pull/13013