Bug 21403 – dmd/backend/cgcs.d:375 assert failed

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-11-18T15:43:29Z
Last change time
2021-03-26T06:19:00Z
Keywords
backend, ice, ice-on-valid-code, pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2020-11-18T15:43:29Z
This test ICE's the dmd backend. --- auto mul11ret3(T)(ref T s) { s ~= 11; return [3]; } auto test(int[] val) { (val ~= mul11ret3(val)) ~= 7; return val; } void main() { static assert(test([2]) == [2, 11, 3, 7]); assert(test([2]) == [2, 11, 3, 7]); } --- & el:0x55f78b3b1ce0 cnt=0 cs=0 & TY* 0x55f78b3b1c20 el:0x55f78b3b1c20 cnt=0 cs=0 call TYucent 0x55f78b3b1bc0 0x55f78b3b19d0 el:0x55f78b3b1bc0 cnt=0 cs=0 var TYC func _d_arrayappendT el:0x55f78b3b19d0 cnt=0 cs=0 param TYvoid 0x55f78b3b1970 0x55f78b3b17b0 el:0x55f78b3b1970 cnt=0 cs=0 param TYvoid 0x55f78b3b1390 0x55f78b3b13f0 el:0x55f78b3b1390 cnt=0 cs=0 call TYucent 0x55f78b3b1190 0x55f78b3b1310 el:0x55f78b3b1190 cnt=0 cs=0 var TYD func _D3bug__T9mul11ret3TAiZQoFNaNbNfKQnZQq el:0x55f78b3b1310 cnt=0 cs=0 relconst TY* 0+& val el:0x55f78b3b13f0 cnt=0 cs=0 relconst TY* 0+& val el:0x55f78b3b17b0 cnt=0 cs=0 var TY* _D11TypeInfo_Ai6__initZ dmd: src/dmd/backend/cgcs.d:375: Assertion `0' failed. Aborted
Comment #1 by ibuclaw — 2020-11-18T16:09:03Z
(In reply to Iain Buclaw from comment #0) > This test ICE's the dmd backend. > --- > auto mul11ret3(T)(ref T s) Aside: A more accurate description of that function would be cat11ret3.
Comment #2 by bugzilla — 2021-03-23T07:21:16Z
A no-template version: int[] mul11ret3(ref int[] s) { s ~= 11; return [3]; } int[] test(int[] val) { (val ~= mul11ret3(val)) ~= 7; return val; } void main() { static assert(test([2]) == [2, 11, 3, 7]); assert(test([2]) == [2, 11, 3, 7]); }
Comment #3 by bugzilla — 2021-03-23T07:24:08Z
And a minimal test case: int[] mul11ret3(ref int[] s); void test(int[] val) { (val ~= mul11ret3(val)) ~= 7; }
Comment #4 by dlang-bot — 2021-03-24T10:11:16Z
@WalterBright created dlang/dmd pull request #12304 "fix Issue 21403 - dmd/backend/cgcs.d:375 assert failed" fixing this issue: - fix Issue 21403 - dmd/backend/cgcs.d:375 assert failed https://github.com/dlang/dmd/pull/12304
Comment #5 by dlang-bot — 2021-03-26T06:19:00Z
dlang/dmd pull request #12304 "fix Issue 21403 - dmd/backend/cgcs.d:375 assert failed" was merged into master: - d6da896ddd145f5ee25c709b5213b0652cd6edc0 by Walter Bright: fix Issue 21403 - dmd/backend/cgcs.d:375 assert failed https://github.com/dlang/dmd/pull/12304