Bug 18403 – [REG2.078.2] Access violation when dmd tries to print highlighted code

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-02-08T21:10:06Z
Last change time
2018-02-15T21:42:05Z
Keywords
ice, pull
Assigned to
No Owner
Creator
naydef

Comments

Comment #0 by naydef — 2018-02-08T21:10:06Z
Hello everyone and excuse me for everything wrong with this thread, I upgraded the dmd from version 2.078.1 to 2.078.2. Everything was working correctly in 2.078.1, but now my project won't build with 2.078.2, the dmd compiler exits with this message E:\bugtest>dub build Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86. bugtest ~master: building configuration "application"... source\app.d(4,4): Deprecation: object.Error@(0): Access Violation ---------------- 0x0065445A 0x006548FE 0x0064DBD3 0x0064DE3F C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1. E:\bugtest> Minimal reproduction example: void main() { ushort i; i=~i; } Yes, i'm using a feature which was deprecated. Again, excuse me if there is something wrong with this bug report
Comment #1 by ag0aep6g — 2018-02-08T22:30:07Z
Also happens on other errors. Seems to be related to code highlighting via backticks in the error message. For example, a source file that's just "foo" also fails. But this works as expected even though it prints a deprecation message (but it doesn't have highlighted code): ---- void main() { shared int x; ++x; } ---- Never fails when dmd is invoked with `-color=off`. The diff between 2.078.1 and 2.078.2 is really small [1], and I can't spot anything that's related to code highlighting. [1] https://github.com/dlang/dmd/compare/v2.078.1...v2.078.2
Comment #2 by ag0aep6g — 2018-02-09T23:37:22Z
Investigated further. This seems to be a case of dmd miscompiling itself. The access violation happens in `dmd.tokens.Token.isKeyword` when it accesses `keywords`. This is because of issue 18412. Pull request to work around that issue: https://github.com/dlang/dmd/pull/7859
Comment #3 by johnnymarler — 2018-02-10T00:24:30Z
Thanks for looking into this. I noticed this as well a little while ago when I was trying out dmd-nightly.
Comment #4 by ag0aep6g — 2018-02-13T10:36:27Z
*** Issue 18431 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2018-02-15T21:42:04Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/af5694e44f574008b00a2eb8ccb79d46ca3f9485 fix issue 18403 - [REG2.078.2] Access violation when dmd tries to print highlighted code (#7859) ... by moving the array declaration before the static constructor. This is a workaround for issue 18412 - [REG2.077.0] immutable array in library becomes null when referenced in static constructor.