D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21164 - segfault on incomplete static if
Summary: segfault on incomplete static if
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: pull
Depends on:
Blocks:
 
Reported: 2020-08-15 17:47 UTC by Stefan Koch
Modified: 2020-11-16 15:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stefan Koch 2020-08-15 17:47:58 UTC
Given the following files :

--- main.d:
import a;
import b;
auto GB(D!Q)
{
}

--- a.d
struct D(E)
{
        void G()        {
                import d;
I;
        }

}

--- b.d
import c;
enum N = O();
alias Q = R!(N, S);

--- c.d
enum S = 1;

struct O
{
}

struct R(O U, int W ) // extend to KPDateTime later
{
}

--- d.d
auto AB()
{
static if}

auto I()
{
AB;
}

dmd will segfault while trying to evaluate the static if condition.
Comment 1 Dlang Bot 2020-09-05 16:09:34 UTC
@UplinkCoder updated dlang/dmd pull request #11585 "Fix Issue 21164 - segfault on incomplete static if" fixing this issue:

- Fix Issue 21164 - segfault on incomplete static if
  
  With this change we now check for the exisitance of an static if
  condition and will only proceed if there is one.

- Add test for issue 21164

https://github.com/dlang/dmd/pull/11585
Comment 2 Dlang Bot 2020-09-11 08:21:29 UTC
dlang/dmd pull request #11585 "Fix Issue 21164 - segfault on incomplete static if" was merged into stable:

- 47f6017d6e65c875a1bff427ed997c678e16f068 by Stefan Koch:
  Fix 21164 - segfault on incomplete static if
  
  With this change we now check for the existance
  of a static if condition and will only proceed
  if there is one.
  
  The test doesn't use the imports folder due to problems
  with path changes on the error message for windows.

https://github.com/dlang/dmd/pull/11585
Comment 3 Dlang Bot 2020-11-16 15:09:51 UTC
dlang/dmd pull request #11971 "[dmd-cxx] Backport fixes for Issue 18970 and 21164" was merged into dmd-cxx:

- cb42c98a9514f7366857f78379c6133c1e6bb098 by Stefan Koch:
  Fix 21164 - segfault on incomplete static if
  
  With this change we now check for the existance
  of a static if condition and will only proceed
  if there is one.
  
  The test doesn't use the imports folder due to problems
  with path changes on the error message for windows.

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