← Back to index
|
Original Bugzilla link
Bug 11159 – [CTFE] Integer exponentiation give incorrect values
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-02T16:31:00Z
Last change time
2013-10-04T12:10:13Z
Keywords
CTFE, patch, pull
Assigned to
nobody
Creator
safety0ff.bugz
Attachments
ID
Filename
Summary
Content-Type
Size
1255
0001-Fix-ctfe-integer-exponentiation.patch
Proposed fix
text/plain
1549
Comments
Comment #0
by safety0ff.bugz — 2013-10-02T16:31:54Z
Example program: import std.stdio; void main() { writeln("==== Runtime ===="); ulong ten = 10, two = 2; writeln(two^^63);// ok writeln(two^^64);// overflows -> 2^64 % 2^64 writeln(ten^^18);// ok writeln(ten^^19);// ok writeln(ten^^20);// overflows -> 10^20 % 2^64 writeln("==== CTFE ===="); enum ulong eten = 10, etwo = 2; writeln(etwo^^63);// ok writeln(etwo^^64);// expect an overflow, gives 2^63 writeln(eten^^18);// ok writeln(eten^^19);// should work, gives 2^63 instead (2^63 > 10^19) writeln(eten^^20);// expect an overflow, gives 2^63 } See attached patch for proposed fix.
Comment #1
by safety0ff.bugz — 2013-10-02T16:32:46Z
Created attachment 1255 Proposed fix
Comment #2
by safety0ff.bugz — 2013-10-02T22:18:12Z
Patch fixes issue 7548, one issue should be marked duplicate of the other.
Comment #3
by safety0ff.bugz — 2013-10-03T07:52:33Z
https://github.com/D-Programming-Language/dmd/pull/2623
Comment #4
by bugzilla — 2013-10-03T22:57:15Z
*** Issue 7548 has been marked as a duplicate of this issue. ***