ID:2152255
 
BYOND Version:510.1346, 511.1352
Operating System:Linux
Web Browser:Chrome 53.0.2785.116
Applies to:Dream Daemon
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary: If a zero-probability entry is passed to pick() in a position other than first, the code compiles but crashes on execution

Numbered Steps to Reproduce Problem: See code.

Code Snippet (if applicable) to Reproduce Problem:
/world/New()
pick(0;0, 1;1) // this is fine
pick(0;0, 1;1, 0;2) // crash!


Expected Results: Either a failed compile, or no crash.

Actual Results: Successful compile, crash.

Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur? Unknown

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds: None

Backtrace (511.1358):
BUG: Crashing due to an illegal operation!
proc name: New (/world/New)
usr: null
src: world
call stack:
world: New()

Backtrace for BYOND 511.1358 on Linux:
Generated at Mon Sep 26 15:40:18 2016

DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804bb24]
libbyond.so [0xf7267000, 0x0], 0x243b6d
linux-gate.so.1 [0xf77b9000, 0xf77b9cf0], [0xf77b9000, 0xf77b9cf0]
libbyond.so [0xf7267000, 0x0], 0x243b6d
libbyond.so [0xf7267000, 0x0], 0x26610e
libbyond.so [0xf7267000, 0x0], 0x26e933
libbyond.so [0xf7267000, 0x0], 0x26fccb
libbyond.so [0xf7267000, 0x0], 0x225156
libbyond.so [0xf7267000, 0x0], 0x22704f
libbyond.so [0xf7267000, 0x0], 0x223189
libbyond.so [0xf7267000, 0x0], 0x223b23
libbyond.so 0x291730, 0x291777
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804ad84]
libc.so.6 0x180a0, 0x18196 (__libc_start_main)
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804a731]

Recent proc calls:
/world/New

Im curious as to how you found this :D
[23 21 54 19] [ Kasuobes] how do probs even work in DM?                                                                                                                                                                                          [23 21 54 54] [ Techhead] It's like the classic marbles in a bag.
[23 21 55 08] [@chinsky] it returns true with [argument] chance
[23 21 55 18] [@chinsky] inbuilt proc so fuck knows how
[23 21 55 31] [@chinsky] I'd guess just a call to some standard library function
[23 21 56 13] [ Techhead] For here: http://www.byond.com/docs/ref/info.html#/proc/pick
[23 21 56 15] [%NanoTrasen_Inc] //TODO: DM Reference
[23 21 56 44] [ Techhead] In a pick(), prob() just shows relative weight.
[23 21 58 12] [ Kasuobes] so the same proc has two different meanings in the same context... great
[23 21 58 26] [ Kasuobes] !dm prob(1)
[23 21 58 27] [%NanoTrasen_Inc] Kasuobes: 0
[23 21 58 41] [ Kasuobes] !dm pick(prob(1))
[23 21 58 43] [%NanoTrasen_Inc] Kasuobes: 0
[23 21 59 02] [@chinsky] !dm prob(200) [23 21 59 02] [ Techhead] Different contexts.
[23 21 59 03] [%NanoTrasen_Inc] ERROR :: 1
[23 21 59 04] [@chinsky] :O [23 21 59 28] [ Techhead] I don't even know if prob() is actually a proc in the context of pick().
[23 22 00 29] [@chinsky] !dm pick(100;"dick", 0;"butts")
[23 22 00 29] [%NanoTrasen_Inc] ERROR :: BUG: Crashing due to an illegal operation!; proc name: dm eval (/proc/dm_eval); usr: (src); src: null; call stack:; dm eval(); world: New(); Backtrace for BYOND 510.1346 on Linux:; Generated at Fri Sep 23 22:00:29 2016; DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804bb24]; libbyond.so [0xb7270000, 0x0], 0x2357cd; [0xb77d6000, 0xb77d6600], [0xb77d6000, 0xb77d6600]; libbyond.so [0xb7270000, ...
[23 22 00 41] * chinsky zoidberg run
[23 22 02 31] [ RKF] butts broke nt
[23 22 03 19] [ Techhead] !dm pick(prob(100);"dick", prob(0);"butts")
[23 22 03 19] [%NanoTrasen_Inc] //TODO: BUG: Crashing due to an illegal operation!; proc name: dm eval (/proc/dm_eval); usr: (src); src: null; call stack:; dm eval(); world: New(); Backtrace for BYOND 510.1346 on Linux:; Generated at Fri Sep 23 22:03:19 2016; DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804bb24]; libbyond.so [0xb7268000, 0x0], 0x2357cd; [0xb77ce000, 0xb77ce600], [0xb77ce000, 0xb77ce600]; libbyond.so [0xb7268000, 0...
[23 22 03 41] [@chinsky] NT isn't dickbutt ready


I blame chinsky.
I've looked into this a little bit, and it's kind of a mess. I'm still trying to figure out how this is being built and where it's going wrong, but I suspect the problem is in the way it gets compiled.