digitalmars.D.bugs - [Issue 4682] New: Run-time Vs Compile-time of int.min % -1
- d-bugmail puremagic.com (33/33) Aug 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4682
- d-bugmail puremagic.com (13/13) Jul 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4682
http://d.puremagic.com/issues/show_bug.cgi?id=4682 Summary: Run-time Vs Compile-time of int.min % -1 Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc With dmd 2.048 this program gives (on Windows) a runtime error: int foo(int x, int y) { return x % y; } void main() { int r = foo(int.min, -1); } But the same operation done at compile time gives no errors, and foo returns 0: int foo(int x, int y) { return x % y; } static assert(foo(int.min, -1) == 0); void main() {} So one of the two cases is wrong (or both). While floating point operations done at compile-time may give slightly different results, I'd like integral operations to give the same results at compile-time and run-time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4682 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 12:08:14 PDT --- https://github.com/D-Programming-Language/dmd/commit/7ef3b2bb9e740df39108957ae5e3b2aa8253d351 https://github.com/D-Programming-Language/dmd/pull/284 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2011