Bug 13569 – Inconsistent integer divide by zero behavior and spec

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-10-03T14:21:45Z
Last change time
2020-08-13T16:51:08Z
Keywords
pull, spec
Assigned to
No Owner
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2014-10-03T14:21:45Z
From: http://forum.dlang.org/thread/[email protected] With linux, integer division by zero results in a core dump. On windows, it results in an Error: object.Error@(0): Integer Division by 0 The spec says an Exception gets thrown. http://dlang.org/expression#MulExpression
Comment #1 by code — 2014-10-04T20:45:22Z
More or less related note: This will be hard to implement correctly on LLVM and probably also GCC (http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-April/060930.html).
Comment #2 by yebblies — 2014-11-11T12:59:28Z
*** This issue has been marked as a duplicate of issue 5908 ***
Comment #3 by code — 2014-11-11T13:27:30Z
Doesn't seem to be a duplicate - at least going by the title, the other issue is specifically about the optimizer for compile-time known divisors. This is about runtime behavior.
Comment #4 by bugzilla — 2020-08-09T10:47:12Z
With -O: int test_int() { int x; return x/x; } long test_long() { long x; return x/x; } now gives a compile-time divide-by-zero error.
Comment #5 by dlang-bot — 2020-08-10T01:45:55Z
@WalterBright created dlang/dlang.org pull request #2842 "fix Issue 13569 - Inconsistent integer divide by zero behavior and spec" fixing this issue: - fix Issue 13569 - Inconsistent integer divide by zero behavior and spec https://github.com/dlang/dlang.org/pull/2842
Comment #6 by dlang-bot — 2020-08-13T16:51:08Z
dlang/dlang.org pull request #2842 "fix Issue 13569 - Inconsistent integer divide by zero behavior and spec" was merged into master: - 406860163074ecf603b13c37005c30e7e32898be by Walter Bright: fix Issue 13569 - Inconsistent integer divide by zero behavior and spec https://github.com/dlang/dlang.org/pull/2842