Bug 8775 – 2.059 worked 2.060 does not: Range Violation

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-10-07T04:28:00Z
Last change time
2012-11-08T19:43:00Z
Assigned to
nobody
Creator
russel

Attachments

IDFilenameSummaryContent-TypeSize
1147pi_d_threadsGlobalState_array_iterative.dpi_d_threadsGlobalState_array_iterative.dtext/x-dsrc1615
1149output_d.doutput_d.dtext/x-dsrc683

Comments

Comment #0 by russel — 2012-10-07T04:28:08Z
Created attachment 1147 pi_d_threadsGlobalState_array_iterative.d The attached code compiles and executes fine under 2.059 on Debian Unstable installed using the distribution deb. Using 2.060 however the following error obtains: core.exception.RangeError@pi_d_threadsGlobalState_array_iterative(42): Range violation ---------------- /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(_d_array_bounds+0x26) [0x4585f2] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative() [0x453d6a] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(void pi_d_threadsGlobalState_array_iterative.execute(immutable(int))+0xc3) [0x44bd6f] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(_Dmain+0x28) [0x44bf4c] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x1c) [0x458dc4] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x45873e] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3b) [0x458e0b] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x45873e] /tmp/.rdmd-1000/rdmd-pi_d_threadsGlobalState_array_iterative.d-78EB353AE451236DB347EDE2878B2CA4/pi_d_threadsGlobalState_array_iterative(main+0xd1) [0x4586c9] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7fb55551bead]
Comment #1 by alex — 2012-10-07T04:56:31Z
pi_d_threadsGlobalState_array_iterative.d(13): Error: module output_d is in file 'output_d.d' which cannot be read import path[0] = . import path[1] = /usr/include/dmd/phobos import path[2] = /usr/include/dmd/druntime/import Failed: 'dmd' '-v' '-o-' 'pi_d_threadsGlobalState_array_iterative.d' '-I.'
Comment #2 by russel — 2012-10-07T05:01:13Z
Created attachment 1149 output_d.d
Comment #3 by alex — 2012-10-07T05:54:49Z
What's breaking here is that on line 42, 'i' is somehow a ridiculous value like -550993920 (during the first run with numberOfThreads = 1 at least). Definitely a compiler bug.
Comment #4 by alex — 2012-10-07T06:02:30Z
FWIW, changing the foreach loop to a for loop makes the code run (presumably correctly; I didn't actually look at what it's supposed to do). ======================== pi_d_threadsGlobalState_array_iterative.d, task count: 1 π = 3.141592653589970752 iteration count = 1000000000 elapse time = 6.938375 number of processors = 8 ======================== pi_d_threadsGlobalState_array_iterative.d, task count: 2 π = 3.141592653589901030 iteration count = 1000000000 elapse time = 3.563860 number of processors = 8 ======================== pi_d_threadsGlobalState_array_iterative.d, task count: 8 π = 3.141592653589769135 iteration count = 1000000000 elapse time = 1.716047 number of processors = 8 ======================== pi_d_threadsGlobalState_array_iterative.d, task count: 32 π = 3.141592653589757589 iteration count = 1000000000 elapse time = 1.609829 number of processors = 8
Comment #5 by russel — 2012-10-07T07:37:56Z
Perhaps worth noting that this code compiles and runs fine using ldc2 compiled from the Git repository.
Comment #6 by russel — 2012-10-07T07:40:51Z
(In reply to comment #4) > FWIW, changing the foreach loop to a for loop makes the code run (presumably > correctly; I didn't actually look at what it's supposed to do). It is supposed to do exactly what you made it do :-) That is calculate approximations to π for a number of different thread counts – to check whether there is close to linear scaling for this embarrassingly parallel problem.
Comment #7 by k.hara.pg — 2012-11-08T19:43:00Z
*** This issue has been marked as a duplicate of issue 8526 ***