Thread overview
[Issue 8775] New: 2.059 worked 2.060 does not: Range Violation
Oct 07, 2012
Russel Winder
Oct 07, 2012
Russel Winder
Oct 07, 2012
Russel Winder
Oct 07, 2012
Russel Winder
Nov 09, 2012
Kenji Hara
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775

           Summary: 2.059 worked 2.060 does not: Range Violation
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: russel@winder.org.uk


--- Comment #0 from Russel Winder <russel@winder.org.uk> 2012-10-07 04:28:08 PDT ---
Created an attachment (id=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]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex@lycus.org


--- Comment #1 from Alex Rønne Petersen <alex@lycus.org> 2012-10-07 13:56:31 CEST ---
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.'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775



--- Comment #2 from Russel Winder <russel@winder.org.uk> 2012-10-07 05:01:13 PDT ---
Created an attachment (id=1149)
output_d.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|druntime                    |DMD


--- Comment #3 from Alex Rønne Petersen <alex@lycus.org> 2012-10-07 14:54:49 CEST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775



--- Comment #4 from Alex Rønne Petersen <alex@lycus.org> 2012-10-07 15:02:30 CEST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775



--- Comment #5 from Russel Winder <russel@winder.org.uk> 2012-10-07 07:37:56 PDT ---
Perhaps worth noting that this code compiles and runs fine using ldc2 compiled from the Git repository.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775



--- Comment #6 from Russel Winder <russel@winder.org.uk> 2012-10-07 07:40:51 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8775


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-08 19:43:00 PST ---
*** This issue has been marked as a duplicate of issue 8526 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------