www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17386] New: Internal error: backend\cgcod.c 1841

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

          Issue ID: 17386
           Summary: Internal error: backend\cgcod.c 1841
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: BugReport.SeijiFujita gmail.com

/*
Title: Internal error: backend\cgcod.c 1841
dmd version: dmd.2.074.0
dmd option: dmd -c -m64 -O -release 

Internal error conditions
-------------------------
1. dmd.2.073.0 - dmd.2.074.0 only
2. dmd option is "m64 - O - release"
3. asm.dlang.org confirmed that internal error occurred in "dmd nightly build,
- m64 - O - release"
4. The following code is minimized by Dustmite
*/
int[] bezier() {

    int[] polygon ;
    for (int i ; ; i++) {
        double t = i ;
        polygon[2 * i]     = cast(int)(t * t );
    }
}

/*
Original code:
location: dwt
org.eclipse.swt.win32.win32.x86\src\org\eclipse\swt\custom\CBanner.d(161):    
int[] bezier(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3,
int count) {


int[] bezier(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3,
int count) {
        // The parametric equations for a Bezier curve for x[t] and y[t] where 
0 <= t <=1 are:
        // x[t] = x0 + 3 (x1 - x0) t + 3 (x0 + x2 - 2x1) t ^ 2 + (x3 - x0 + 3x1
- 3x2) t ^ 3
        // y[t] = y0 + 3 (y1 - y0) t + 3 (y0 + y2 - 2y1) t ^ 2 + (y3 - y0 + 3y1
- 3y2) t ^ 3

    double a0 = x0;
    double a1 = 3 * (x1 - x0);
    double a2 = 3 * (x0 + x2 - 2 * x1);
    double a3 = x3 - x0 + 3 * x1 - 3 * x2;
    double b0 = y0;
    double b1 = 3 * (y1 - y0);
    double b2 = 3 * (y0 + y2 - 2 * y1);
    double b3 = y3 - y0 + 3 * y1 - 3 * y2;

    int[] polygon = new int[2 * count + 2];
    for (int i = 0; i <= count; i++) {
        double t = cast(double) i / cast(double) count;
        polygon[2 * i]     = cast(int)(a0 + a1 * t + a2 * t * t + a3 * t * t *
t);
        polygon[2 * i + 1] = cast(int)(b0 + b1 * t + b2 * t * t + b3 * t * t *
t);
    }
    return polygon;
}

/// Dustmite 
// dmd -c -m64 -O -release  CBanner_dmdInternalerror.d > out.txt
// dustmite src "dmd -c -m64 -O -release CBanner_dmdInternalerror.d | diff -
..\out.txt"

*/

--
May 09 2017