D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19491 - ICE (segfault) when initializing scope variable with shared type
Summary: ICE (segfault) when initializing scope variable with shared type
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-15 14:39 UTC by zopsicle
Modified: 2018-12-24 19:22 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 zopsicle 2018-12-15 14:39:52 UTC
Tested with DMD 2.081.2. This bug does not seem to occur on DMD 2.073.

The following example causes DMD to ICE with a segfault:

$ cat example.d
class Foo {
    shared this() { }
}

void main() {
    scope foo = new shared Foo();
}
$ dmd example.d
Segmentation fault

If you replace scope by auto then it will compile just fine.
Comment 1 RazvanN 2018-12-17 10:22:36 UTC
This looks like a backend bug.
Comment 2 Walter Bright 2018-12-21 07:22:27 UTC
https://github.com/dlang/dmd/pull/9109
Comment 3 github-bugzilla 2018-12-24 19:22:42 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/2d658b7ed076ba789e67907ec37be2ff0671fd1f
fix Issue 19491 - ICE (segfault) when initializing scope variable with shared type

https://github.com/dlang/dmd/commit/57c8a5e4a70144846359051d7c9c1ff4612cbd57
Merge pull request #9109 from WalterBright/fix19491

fix Issue 19491 - ICE (segfault) when initializing scope variable wit…
merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>