Bug 24072 – cast(__vector) array literal incorrectly triggers GC error

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-08-05T10:36:59Z
Last change time
2023-11-20T11:13:24Z
Keywords
industry, pull
Assigned to
No Owner
Creator
johanengelen

Comments

Comment #0 by johanengelen — 2023-08-05T10:36:59Z
Testcase: ``` import core.simd; struct Mins { int4 val; } void OK() @nogc { Mins b = Mins([1,2,3,4]); } void not_OK() @nogc { Mins b = Mins(cast(__vector(int[4]))[1,2,3,4]); } ``` gives error: <source>(12): Error: array literal in @nogc function example.not_OK may cause a GC allocation But this code does not trigger GC allocation of the array, and thus should be accepted. `cast(int[4])` does work, so that logic should be extended to allow casting to vector types.
Comment #1 by dlang-bot — 2023-08-08T10:30:21Z
@dkorpel created dlang/dmd pull request #15516 "Fix 24072 - cast(__vector) array literal incorrectly triggers GC error" fixing this issue: - Fix 24072 - cast(__vector) array literal incorrectly triggers GC error https://github.com/dlang/dmd/pull/15516
Comment #2 by dlang-bot — 2023-11-14T23:04:06Z
dlang/dmd pull request #15516 "Fix 24072 - cast(__vector) array literal incorrectly triggers GC error" was merged into stable: - 59a40525292b2d98095191675ed8289d4878eb42 by Dennis Korpel: Fix 24072 - cast(__vector) array literal incorrectly triggers GC error https://github.com/dlang/dmd/pull/15516
Comment #3 by dlang-bot — 2023-11-20T11:13:24Z
dlang/dmd pull request #15829 "merge stable" was merged into master: - 3d552df287d0b836861f760701b16569311e4dd7 by Dennis Korpel: Fix 24072 - cast(__vector) array literal incorrectly triggers GC error https://github.com/dlang/dmd/pull/15829