locked
error C1001: An internal error has occurred in the compiler

    Question

  • I am not a C/C++ developer, but I'm trying to port some C++ into a WinRT component. The project builds fine in Debug but fails with C1001 in Release.

    This is a code snippet of where it fails (the error line is the second for loop, the one with wq variable)

    void init_material() { int wp, bp, wn, bn, wl, bl, wd, bd, wr, br, wq, bq, index, score, phase, wb, bb; int w_maj, b_maj, w_maj_score, b_maj_score, w_min, b_min, w_tot_score, b_tot_score, wmul, bmul; for (index = 0; index < TotalMat; index++) Material[index] = 0xFFFFFFFF; for (wq = 0; wq < 3; wq++) for (bq = 0; bq < 3; bq++) for (wr = 0; wr < 3; wr++)

    ...



    Valentin Iliescu

    Saturday, April 7, 2012 5:50 AM

Answers

  • I've reported this bug to the product group. To work around, you can use a pragma:

    #pragma optimize("", off)
    void init_material() 
    {
    //...
    }
    #pragma optimize("", on)

    You can also use the predefined compiler macros to scope this workaround to just the compiler version with the issue

    http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.110).aspx

    -Steve

    Thursday, April 12, 2012 6:15 PM
    Moderator

All replies