[Bug 115] New: Union literals as rvalues yields different values every run

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Sat Apr 5 14:32:43 PDT 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=115

            Bug ID: 115
           Summary: Union literals as rvalues yields different values
                    every run
    Classification: Unclassified
           Product: GDC
           Version: 4.8.x
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: klas.bjorkqvist at gmail.com

When running the following program:

a.d
------
import std.stdio;

union _f {
  float f;
  uint i;
}

void func(const uint x) {
  writeln(x);
}

void main() {
  float a = 123.0;
  const l = _f(a);
  func(l.i);
  func(_f(a).i);
}
----

multiple times, the value printed for "_f(a).i" is different each time, and
appears mostly random when compared to the value of "l.i". 

> gdc a.d && ./a.out
1123418112
430703264
> ./a.out           
1123418112
3680514720
> ./a.out
1123418112
2543067808

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140405/26339dd4/attachment.html>


More information about the D.gnu mailing list