Bug 24235 – Functions 0-out single element static arrays

Status
NEW
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2023-11-08T20:07:45Z
Last change time
2024-12-13T19:31:40Z
Keywords
backend, wrong-code
Assigned to
No Owner
Creator
isaacbunsen
Moved to GitHub: dmd#20355 →

Comments

Comment #0 by isaacbunsen — 2023-11-08T20:07:45Z
when passing a single element static array of float[1] or double[1] that accepts multiple arguments, one will find that the argument is 0 when the function is called. For example, the following code fails the assert. `a` is an array of [0] no matter what is passed in. This does no happen if the second argument is removed, or the length of the array is increased. float test(float[1] a, float whatever) { return a[0]; } unittest { assert(test([1.0], 1) == 1); }
Comment #1 by isaacbunsen — 2023-11-08T20:10:43Z
DMD64 D Compiler v2.105.3-dirty Windows 10 Home Version 10.0.19045
Comment #2 by isaacbunsen — 2023-11-08T20:28:44Z
Also fails on DMD32 D Compiler v2.100.2-dirty
Comment #3 by isaacbunsen — 2023-11-09T00:42:53Z
Prior tests were run on a Microsoft surface pro 7 Intel(R) Core(TM) i3-1005G1 CPU Windows 10 Home Version 10.0.19045 DMD64 D Compiler v2.105.3-dirty The issue does not occur on my other windows computer. Intel(R) Core(TM) i7-6700HQ CPU Windows 10 Education DMD64 D Compiler v2.105.2-dirty The issue does not occur on the surface pro 7 when building and running on Ubuntu through WSL.
Comment #4 by razvan.nitu1305 — 2023-11-09T09:54:11Z
I can confirm that this cannot be reproduced on a linux system.
Comment #5 by isaacbunsen — 2023-11-09T19:14:35Z
Important to note, I am building with dub
Comment #6 by isaacbunsen — 2023-11-09T19:26:09Z
I have narrowed it down. `dmd -m64 [file]` and `dmd -debug [file]` both trigger the assert. Both flags are passed by dub on my machine. `dmd [file]` does not trigger the assert.
Comment #7 by robert.schadek — 2024-12-13T19:31:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20355 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB