Bug 13607 – BigInt math not usable in @safe code

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-10-13T02:59:11Z
Last change time
2024-12-01T16:22:41Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Brad Roberts
Blocks
18110
Moved to GitHub: phobos#10092 →

Comments

Comment #0 by braddr — 2014-10-13T02:59:11Z
module bitintsafe; import std.bigint; void main() @safe { BigInt i, j, k; i = j + k; } $ dmd -c bigintsafe.d bigintsafe.d(8): Error: safe function 'D main' cannot call system function 'std.bigint.BigInt.opBinary!("+", BigInt).opBinary' I started looking into this but the rabit hole is fairly deep. Filing a bug in hopes that someone will take up the charge on this one while I work on others. I don't consider this an enhancement request since @safe and phobos really need to be in the 'just works' state.
Comment #1 by rburners — 2014-10-14T12:19:27Z
I had a PR open for this a while back. https://github.com/D-Programming-Language/phobos/pull/2357 It came down to the same argument you're having on the newsgroup right now.
Comment #2 by braddr — 2014-10-14T17:05:01Z
It also suffered from being too big. It would have been nice to get the non-controversial parts of the change in. There was very little use of the @trusted sledge hammer.
Comment #3 by rburners — 2014-10-14T20:43:31Z
Comment #4 by bugzilla — 2016-06-12T08:13:17Z
(In reply to Robert Schadek from comment #3) > https://github.com/D-Programming-Language/phobos/pull/2612 > > another try That was merged, but the error remains.
Comment #5 by hsteoh — 2017-04-26T18:03:22Z
A further step in this direction: https://github.com/dlang/phobos/pull/5354 It's still not complete; BigInt is a pretty deep rabbit warren that will need some time to completely sort out. One step at a time!
Comment #6 by hsteoh — 2017-04-26T18:45:08Z
What should be done about the inline asm heavily used by the BigInt implementation? We could use the sledgehammer approach and slap @trusted on all the inline asm code, but I'm a bit hesitant to do that.
Comment #7 by bugzilla — 2019-12-24T12:48:11Z
This is more an enhancement, than a bug. Isn't it?
Comment #8 by robert.schadek — 2024-12-01T16:22:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10092 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB