D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18581 - Segmentation fault with dmd -X if static foreach inside template
Summary: Segmentation fault with dmd -X if static foreach inside template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 critical
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2018-03-08 20:37 UTC by Ali Ak
Modified: 2019-02-27 03:39 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 Ali Ak 2018-03-08 20:37:33 UTC
The following seg faults:

template A(T) {
  static foreach(I; 0 .. 1) { }
  alias A = T;
}

void main() {
  A!int a;
}

$ dmd -o- -X main.d

Comment out the static foreach and it won't segfault anymore.

Tried with dmd v2.079.0-beta.1 and dmd v2.078.3 locally, and on run.dlang.io you get:

Since      2.076.1: Segfault and no output

https://run.dlang.io/is/SliEb2
Comment 1 Victor Porton 2019-02-27 03:39:27 UTC
It seems to be fixed:

$ dmd -o- -X main.d
Error: module `main` is in file 'main.d' which cannot be read
import path[0] = /snap/dmd/49/bin/../import/druntime
import path[1] = /snap/dmd/49/bin/../import/phobos
t,1$ dmd --version
DMD64 D Compiler v2.084.1
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright