https://issues.dlang.org/show_bug.cgi?id=15898

          Issue ID: 15898
           Summary: [REG2.069] Internal error: backend\cgcod.c 1651
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: ice
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: k.hara...@gmail.com

>From 2.069, following code is broken.

Code:

int addAssignSimple(int[] , const(int)[] )
{
    uint c;
    return c;
}

void mulKaratsuba(int[] result, const(int)[] x, const(int)[] y, int[] )
{
    const(int)[] y1 = y;
    int[] newscratchbuff;
    int[] resultHigh = result;

    bool ysmaller2 = x.length >= y1.length;
    newscratchbuff[0..y1.length] = resultHigh;
    mulKaratsuba(
        resultHigh[1..$],
        ysmaller2 ? x[1..$] : y1,
        ysmaller2 ? y1 : x,
        newscratchbuff[y1.length..$]
    );

    addAssignSimple(resultHigh[1..$], newscratchbuff[0..y1.length]);
}

Command and output:

> dmd -O -c test.d
DMD v2.069 DEBUG
findreg(0, line=1919, file='backend\cgcod.c', function =
'_D4test12mulKaratsubaFAiAxiAxiAiZv')
Internal error: backend\cgcod.c 1651

Regression introduced in:
https://github.com/D-Programming-Language/dmd/pull/5100

--

Reply via email to