D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17146 - Internal error: tk.c 266 with -O -inline
Summary: Internal error: tk.c 266 with -O -inline
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: backend, ice, ice-on-valid-code, pull
Depends on:
Blocks:
 
Reported: 2017-02-05 00:24 UTC by Sönke Ludwig
Modified: 2021-04-08 10:06 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sönke Ludwig 2017-02-05 00:24:57 UTC
---
final class C {
	void foo() {
		S[] s;
		if (s[$-1] == S.init) {}
	}
}

struct S { int[] a; int b; }

void bar() { C.init.foo(); }
---

compiling with "dmd -O -inline" yields "Internal error: tk.c 266"

Original occurrence: https://github.com/rejectedsoftware/diet-ng/issues/15
Comment 1 Sönke Ludwig 2017-02-05 00:26:01 UTC
Appears on at least DMD 2.070.0 up to DMD 2.073.0.
Comment 2 basile-z 2019-03-02 09:57:19 UTC
Nowadays it's 

dmd: dmd/backend/dvec.d:299: Assertion `v && (b < vec_numbits(v))' failed.
Comment 3 Sönke Ludwig 2020-01-31 14:37:29 UTC
Appears to have been fixed in 2.084.0
Comment 4 Walter Bright 2021-04-08 07:29:44 UTC
The bug is still there. It "disappeared" for a time because asserts were turned off in the backend, obviously that was a bad idea.
Comment 5 Walter Bright 2021-04-08 07:36:12 UTC
Simpler test case:

 struct S { int[] a; int b; }

 void foo() {
    S[] s;
    if (s[$-1] == S.init) {}
 }

 void bar() { foo(); }
Comment 6 Dlang Bot 2021-04-08 08:16:28 UTC
@WalterBright created dlang/dmd pull request #12403 "fix Issue 17146 - Internal error: tk.c 266 with -O -inline" fixing this issue:

- fix Issue 17146 - Internal error: tk.c 266 with -O -inline

https://github.com/dlang/dmd/pull/12403
Comment 7 Dlang Bot 2021-04-08 10:06:27 UTC
dlang/dmd pull request #12403 "fix Issue 17146 - Internal error: tk.c 266 with -O -inline" was merged into master:

- 19c8234b8e3e81584824e50149729965e4eb4286 by Walter Bright:
  fix Issue 17146 - Internal error: tk.c 266 with -O -inline

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