[Issue 16261] New: dmd -profile & nativeToLittleEndian() --> wrong result
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 10 02:59:51 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16261
Issue ID: 16261
Summary: dmd -profile & nativeToLittleEndian() --> wrong result
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: johan556 at gmail.com
When the -profile flag is given to dmd, a call to nativeToLittleEndian() gives
wrong result. The following code works without -profile:
import std.stdio;
import std.bitmanip;
int
main(string[] argv)
{
int value = 42;
auto res = nativeToLittleEndian(value);
writeln("nativeToLittleEndian(", value, ") = ", res);
// expected output: nativeToLittleEndian(42) = [42, 0, 0, 0]
return 0;
}
but with -profile it prints what seems to be garbage bytes, even different
values each time the program is executed.
The version of the compiler was "DMD64 D Compiler v2.071.1", and I have also
built DMD from source today getting the same problem.
I also tried the example code in the documentation of nativeToLittleEndian() at
dlang.org. There too, when I build with -profile, the code does not work (gives
an assert).
--
More information about the Digitalmars-d-bugs
mailing list