A strange div bug on Linux x86_64, (both dmd & ldc2): long -5000 / size_t 2 = 9223372036854773308

mw mingwu at gmail.com
Mon Aug 17 17:06:55 UTC 2020

On Monday, 17 August 2020 at 11:11:22 UTC, Andrei Alexandrescu 
> On 8/13/20 6:13 AM, FeepingCreature wrote:
>> Changing integer promotion rules to disallow promotion of 
>> signed to unsigned for division will not cause massive silent 
>> breakage. - But it will cause massive visible breakage; Phobos 
>> uses this all over.
> I wonder if such a change would uncover any bugs in phobos.


On Monday, 17 August 2020 at 11:24:08 UTC, Andrei Alexandrescu 
> On 8/14/20 5:29 PM, Walter Bright wrote:
>> On 8/14/2020 6:32 AM, Adam D. Ruppe wrote:
>>> just I don't care, I want 16 bit operations here.
>> The design considerations are mutually incompatible:
>> 1. performance
>> 14. should work like Python
> Heh, this looks like a list of things CheckedInt is supposed to 
> help with.

That's why I did this study: use checkedint as a drop-in 
replacement of native long


and logged this bug:


If we can have these enhancements fixed faster, we will be able 
to quickly test the replacement in any library (even better with 
a compiler command line option to activate the switch).

More information about the Digitalmars-d mailing list