Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 307 - internal compiler error: Segmentation fault
Summary: internal compiler error: Segmentation fault
Status: ASSIGNED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: All Linux
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2018-09-04 21:35 CEST by zorael
Modified: 2023-01-07 21:03 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zorael 2018-09-04 21:35:59 CEST
Manjaro/Arch x86_64, gdc 8.2.0 from AUR/gdc-git.

> $ gdc --version
> gdc (GDC 8.2.0 based on D v2.081.2 built with ISL 0.19 for Arch Linux) 8.2.0

The heavily reduced snippet at the following gist segfaults when compiling.

> https://gist.github.com/zorael/f4a5f37a5bccdcb16539cc0c27d8f1f9
Comment 1 Iain Buclaw 2018-09-05 00:05:31 CEST
Reproducible on stable/2.076 also.
Comment 2 Iain Buclaw 2018-09-05 00:43:52 CEST
Reduced and pasted here (gists may have a habit of disappearing).

---
void crash()
{
    applyConfiguration(42);
}

void applyConfiguration(Things...)(Things things)
{
thingloop:
    foreach (i; things)
    {
        switch (i) 
        {   
            continue thingloop;

            default:
        }   
    }   
}
---

Problem is triggered by unrolled loop statements.
Comment 3 Iain Buclaw 2018-09-05 01:00:40 CEST
More complete test that covers three combinations of problems:

1. Continue label in unrolled loop
2. Break label in unrolled loop
3. Loop body unrolled more than once.

I have something for 1 and 2, but not 3 currently.

---
void test307()
{
    apply307(1, 2, 3);
}

void apply307(T...)(T ts)
{
tloop:
    foreach (t; ts)
    {
        switch (t)
        {
            continue tloop;
            default:
        }
    }
tloop2:
    foreach (t; ts)
    {
        switch (t)
        {
            break tloop;
            default:
        }
    }
}
Comment 4 Iain Buclaw 2018-09-05 01:06:33 CEST
Actually, there's more.

---
void test307()
{
    apply307(1, 2, 3);
}

void apply307(T...)(T ts)
{
tloop:
    foreach (t; ts)
    {
        switch (t)
        {
            continue tloop;
            default:
        }
    }
tloop2:
    foreach (t; ts)
    {
        switch (t)
        {
            break tloop;
            default:
        }
    }
tloop3:
    foreach (t; ts)
    {
        switch (t)
        {
            continue;
            default:
        }
    }
tloop4:
    foreach (t; ts)
    {
        switch (t)
        {
            break;
            default:
        }
    }
}
---

I think I have a fix, though will try it out later...