D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19788 - compiler crash on slicing a enum typed as vector
Summary: compiler crash on slicing a enum typed as vector
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ice, pull, SIMD
Depends on:
Blocks:
 
Reported: 2019-04-04 09:51 UTC by basile-z
Modified: 2022-10-22 18:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description basile-z 2019-04-04 09:51:08 UTC
crasher:

---
void main()
{
    enum v = __vector(float[4]).init;
    const(float)[] a = v[];
}    
---

> dmd: dmd/backend/cod2.d:4261: Assertion `cast(int)(*e).Eoper == 147 || cast(int)(*e).Eoper == 146' failed.

Does not happen if v storage is set to `const` instead of `enum`
Comment 1 Dlang Bot 2020-12-21 08:55:53 UTC
@WalterBright created dlang/dmd pull request #12043 "fix Issue 19788 - compiler crash on slicing a enum typed as vector" fixing this issue:

- fix Issue 19788 - compiler crash on slicing a enum typed as vector

https://github.com/dlang/dmd/pull/12043
Comment 2 Dlang Bot 2020-12-21 09:30:02 UTC
dlang/dmd pull request #12043 "fix Issue 19788 - compiler crash on slicing a enum typed as vector" was merged into master:

- 8f475d87e726310c9491f6938f132cbc013f8297 by Walter Bright:
  fix Issue 19788 - compiler crash on slicing a enum typed as vector

https://github.com/dlang/dmd/pull/12043
Comment 3 Walter Bright 2022-10-20 08:28:29 UTC
This is now regarded as an error, as it is slicing an rvalue.
Comment 4 Walter Bright 2022-10-20 08:31:32 UTC
Use .array property instead of slicing.
Comment 5 Dlang Bot 2022-10-22 18:18:34 UTC
dlang/dmd pull request #14580 "cannot slice xmm rvalue" was merged into master:

- 5a10d1eb723383881ce4f5df5129134028febde2 by Walter Bright:
  Fixes incorrect fix issue 19788 about slicing xmm value
  
  Fixes incorrect fix for https://issues.dlang.org/show_bug.cgi?id=19788

https://github.com/dlang/dmd/pull/14580