[Issue 21215] std.range.recurrence leads to an infinite loop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 23 18:02:05 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21215

Ajieskola at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |Ajieskola at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Ajieskola at gmail.com ---
This is intended behaviour.

When recurrency function is called with 0, sequence.dropExactly is called with
0ul - 1, which overflows to ulong.max. The code is multiplying the previous
factorial ulong.max times.

It is not an infinite loop literally, but would presumably take thousands of
years to complete.

--


More information about the Digitalmars-d-bugs mailing list