-
Notifications
You must be signed in to change notification settings - Fork 174
Description
AO call stack in this case:
CalendarDateUntil (endless loop) called by
DifferenceZonedDateTime called by
DifferenceZonedDateTimeWithRounding called by
%Temporal.Duration.prototype.round%This case is from test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-negative-epochnanoseconds.js
For this call (step 14 in DifferenceZonedDateTime)
CalendarDateUntil(calendar, startDateTime.[[ISODate]], intermediateDateTime.[[ISODate]], dateLargestUnit);where
calendaris"iso8601"startDateTime.[[ISODate]]is{ Year: 1969, Month: 7, Day: 24 }intermediateDateTime.[[ISODate]]is{ Year: 1969, Month: 7, Day: 25 }dateLargestUnitis~day~
It will be in an endless loop in CalendarDateUntil step 3.j because ISODateSurpasses(sign, one, two, years, months, weeks, candidateDays) will return false (ISODateSurpasses) forever.
j. Repeat, while ISODateSurpasses(sign, one, two, years, months, weeks, candidateDays) is false,
i. Set days to candidateDays.
ii. Set candidateDays to candidateDays + sign.In this loop, only candidateDays is touched; months is forever 0 because month is only touched when largestUnit is ~week~ (in this case, largestUnit is ~days~).
In ISODateSurpasses, days (candidateDays) will only be visited after step 5, but since month is forever 0, this AO will always return false, thus causing the endless loop.
5. If months = 0, return false.Please let me know if I got something wrong, thanks!