Chez Scheme: raise catchable exception for expt with huge result#1017
Conversation
|
I see that the latest commit moves the practical-limit check to the Scheme side — thanks! — but I'm skeptical of that number. Lets assume that the magic number 40 is given a name in "cmacros.ss": In the context of things like Typed Racket tests, maybe the right thing is to use |
|
A few thoughts:
More generally I'm not sure what the philosophy should be here. My thought was that safe Scheme operations should not trigger aborts, even when they try to allocate large amounts of memory. But maybe that's not the goal and we should be a lot more permissive at the cost of aborts so that if there is enough memory the operation will succeed. |
b179995 to
1ec12b2
Compare
Definitely a Racket bug, with not enough |
|
This now uses |
|
There are a bunch of Unless I'm confused, it turns out that a fixnum can never be as large as For |
Also, add a note about why the check is there, and adjust the release note slightly.
|
This looks good to me! I've pushed a commit for small suggestions, which you can further adjust or take back out, as you see fit. (If you approve, then it will be squashed into your on merge.) The suggested commit adjusts the check to avoid potential overflow in the future, adds a not about why the check is there, and adjusts the release note slightly. I'm not sure whether the release note belongs in functionality changes or bug fixes, but I'm fine with listing it as a bug fix. |
|
Your adjustments look good to me. |
Raise a catchable exception for
exptwith an integer base and bignum exponent, rather than consuming all memory and aborting. Also add a practical size limit inS_bignumto catch cases where the exponent is a large fixnum (e.g., on 64-bit).This was found in the random testing for Typed Racket, see racket/typed-racket#1494.