January 16, 2013 Is this a bug? | ||||
---|---|---|---|---|
| ||||
Hello,
When compiling next code to 64-bit.
app.d
----
import std.stdio;
void main()
{
ubyte u1 = cast(byte)-1;
byte u2 = cast(short)-1;
uint u3 = cast(int)-1;
int u4 = cast(long)-1;
writefln("%d", u1);
writefln("%d", u2);
writefln("%d", u3);
writefln("%d\n", u4);
writefln("long.sizeof: %d ulong.max: %20d", ulong.sizeof, ulong.max);
writefln("long.sizeof: %d long max: %20d", long.sizeof, long.max);
}
----
Prints this:
----
255
-1
4294967295
-1
long.sizeof: 8 ulong.max: 4294967295 long.sizeof: 8 long max: 9223372036854775807
----
"ulong.max" value is incorrect
Tested with dmd version 2.056, 2.057, 2.058, 2.059, 2.060 and 2.061
No problem when compiling to 32-bit.
--
Jordi Sayol
|
January 16, 2013 Re: Is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jordi Sayol | Yes, this seems to be a DMD codegen bug – works with LDC. David |
Copyright © 1999-2021 by the D Language Foundation