error C1001: An internal error has occurred in the compiler
-
Saturday, April 07, 2012 5:50 AM
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
All Replies
-
Monday, April 09, 2012 8:27 AMModerator
Hello,
Would you please provide us more codes about this issue, like how to define Material and then how to use it in your for loop.
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
Monday, April 09, 2012 4:43 PMI don't think I can create a smaller sample, but I can send you the entire WinRT project.
Valentin Iliescu
-
Tuesday, April 10, 2012 6:22 AMModerator
Ok, Please upload your project to skydriver, and post the link here.
http://skydrive.live.com/Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, April 10, 2012 4:32 PM
I have uploaded the project as GullChess.zip here
https://skydrive.live.com/redir.aspx?cid=a7cd34fab0459777&resid=A7CD34FAB0459777!1265&parid=A7CD34FAB0459777!709&authkey=!ACUAQIoGBTcJlQQBuilding in Debug works fine. The issue shows up when building Release. The platform (X64, X86 etc) does not matter.
Valentin Iliescu
-
Wednesday, April 11, 2012 5:29 AMModerator
Hello,
I found that this is optimization's problem. If we change /O1 to /O2, it will work fine.
http://msdn.microsoft.com/en-us/library/8f8h5cxt(v=vs.110).aspxI will involve more experts to investigate it, Thanks for your feedback.
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
Wednesday, April 11, 2012 6:55 AMThanks for the fix. Changing the flag from /O2 to /O1 will fix the issue only if the platform is set to WIN32, it will still fail for x64 and ARM.
Valentin Iliescu
-
Thursday, April 12, 2012 6:15 PMModerator
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
- Proposed As Answer by Jesse JiangMicrosoft Contingent Staff, Moderator Friday, April 13, 2012 1:34 AM
- Marked As Answer by Valentin Iliescu Friday, April 13, 2012 4:13 AM
-
Friday, April 13, 2012 1:25 AMThe pragma works great, it avoids the issue on all platforms.
Valentin Iliescu


