https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95174
Iain Buclaw <ibuclaw at gdcproject dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> --- (In reply to Witold Baryluk from comment #0) > https://explore.dgnu.org/z/LppySp > > [--snip--] > > Is incorrectly compiled to 'nop; ret' > It is correct, all those functions do nothing. What you're missing is a 'ref' or 'out' storage class on the 'o' parameter. Rationale, static arrays are value types in D (they don't saturate to pointers like in C). See https://dlang.org/spec/arrays.html#static-arrays > > As a bonus: > > ``` > void fffff(immutable(float[4]) x, float[4] o) { > o[2] = x[1] + x[3]; > } > > import std.stdio : writeln; > > void main() { > immutable(float[4]) k = [7.0f, 5.3f, 1.2f, 3.2f]; > float[4] o; > fffff(k, o); > writeln(o); > } > > ``` > > prints '[nan, nan, nan, nan]', but it should: '[nan, nan, 8.5, nan]'. > > All NaNs is the correct result here too.