February 08, 2019 [Issue 19662] New: x86_64: Different code output when compiling with inline/boundscheck on/off | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19662 Issue ID: 19662 Summary: x86_64: Different code output when compiling with inline/boundscheck on/off Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: skocznymr@gmail.com The code below has different output depending on compilation options. Reproduced on Windows 10, DMD version v2.084.1-beta.1-master-1f85d7f, 64bit compilation. Doesn't occur when compiling to 32bit. Code partially lifted from dlib package. import std.stdio; import std.math; class Foo { Quaternion!float rotation; } class ObjHolder { Object[int] objs; } struct Quaternion(T) { Vector!(T,4) vectorof; alias vectorof this; Vector!() opBinaryRight() () { } static Quaternion!(T) fromEulerAngles(Vector!(T,3) e) { Quaternion!(T) q; T sr = sin(e.x ); q.w = sr; q.x = sr; q.y = sr; return q; } } struct Vector(T, int size) { static elements(string[] letters) { string res; foreach (i; 0..size) res ~= "T " ~ letters[i] ~ "; "; return res; } union { struct { mixin(elements(["x", "y", "z", "w"])); } } } alias Vector3f = Vector!(float, 3); void main() { ObjHolder oh = new ObjHolder; Object o = new Object; oh.objs[0] = o; writeln(oh.objs); Foo f = new Foo; f.rotation = Quaternion!float.fromEulerAngles(Vector3f()); } >dmd app.d -m64 >app [0:object.Object] <- good >dmd -inline app.d -m64 >app [0:object.Object] <- good >dmd -O -release app.d -m64 >app [0:object.Object] <- good >dmd -O -release -inline app.d -m64 >app [0:null] <- bad >dmd -O -release -inline -boundscheck=on app.d -m64 >app [0:object.Object] <- good >dmd -O -release -inline -boundscheck=off app.d -m64 >app [0:null] <- bad -- |
Copyright © 1999-2021 by the D Language Foundation