Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libs\gil\test\core\histogram\fill.cpp(64): fatal error C1001: Internal compiler error #645

Open
mloskot opened this issue Apr 12, 2022 · 5 comments
Labels
cat/annoyance Not a bug, not a feature, but something that should be improved core boost/gil

Comments

@mloskot
Copy link
Member

mloskot commented Apr 12, 2022

Actual behavior

Currently, this internal error is occurring for two CI jobs (recently improved by @striezel)

  • windows (msvc-14.3, 14,17,latest, 32,64, windows-2022)
  • windows (msvc-14.2, 14,17,latest, 32,64, windows-2019)

Here is sample log:

2022-04-09T12:28:10.5312066Z compile-c-c++ bin.v2\libs\gil\test\core\histogram\fill.test\msvc-14.3\dbg\adrs-mdl-32\cxstd-ltst-iso\thrd-mlt\fill.obj
2022-04-09T12:28:10.5520345Z fill.cpp
2022-04-09T12:28:10.5555671Z libs\gil\test\core\histogram\fill.cpp(64): fatal error C1001: Internal compiler error.
2022-04-09T12:28:10.5558643Z (compiler file 'msc1.cpp', line 1691)
2022-04-09T12:28:10.5593791Z  To work around this problem, try simplifying or changing the program near the locations listed above.
2022-04-09T12:28:10.6231214Z If possible please provide a repro here: https://developercommunity.visualstudio.com 
2022-04-09T12:28:10.6231947Z Please choose the Technical Support command on the Visual C++ 
2022-04-09T12:28:10.6424482Z  Help menu, or open the Technical Support help file for more information
2022-04-09T12:28:10.6481826Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\vector(1946): note: while evaluating constexpr function 'std::vector<std::_Vbase,std::allocator<std::_Vbase>>::data'
2022-04-09T12:28:10.6509015Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\vector(2240): note: while evaluating constexpr function 'std::_Vb_iter_base<_Alvbase_wrapped>::_Total_off'
2022-04-09T12:28:10.6552876Z         with
2022-04-09T12:28:10.6602833Z         [
2022-04-09T12:28:10.6608564Z             _Alvbase_wrapped=std::_Wrap_alloc<std::allocator<std::_Vbase>>
2022-04-09T12:28:10.6620406Z         ]
2022-04-09T12:28:10.6628742Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\xutility(4036): note: while evaluating constexpr function 'std::_Vb_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>::operator *'
2022-04-09T12:28:10.6652164Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\vector(2816): note: while evaluating constexpr function 'std::_Copy_unchecked'
2022-04-09T12:28:10.6688282Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\vector(2798): note: while evaluating constexpr function 'std::vector<bool,std::allocator<bool>>::_Insert'
2022-04-09T12:28:10.6766846Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\include\vector(2529): note: while evaluating constexpr function 'std::vector<bool,std::allocator<bool>>::insert'
2022-04-09T12:28:10.6819916Z INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\cl.exe'
2022-04-09T12:28:12.0979146Z     Please choose the Technical Support command on the Visual C++
2022-04-09T12:28:12.0979696Z     Help menu, or open the Technical Support help file for more information
2022-04-09T12:28:12.0979977Z 
2022-04-09T12:28:12.0980652Z     call "bin.v2\standalone\msvc\msvc-14.3\adrs-mdl-32\archt-x86\msvc-setup.bat"  >nul
2022-04-09T12:28:12.0987215Z  cl /Zm800 -nologo "libs\gil\test\core\histogram\fill.cpp" -c -Fo"bin.v2\libs\gil\test\core\histogram\fill.test\msvc-14.3\dbg\adrs-mdl-32\cxstd-ltst-iso\thrd-mlt\fill.obj"     -TP /wd4675 /EHs /std:c++latest /GR /Zc:throwingNew /Z7 /Od /Ob0 /W3 /MDd /Zc:forScope /Zc:wchar_t /Zc:inline -DBOOST_ALL_NO_LIB=1 -DBOOST_GIL_USE_CONCEPT_CHECK=1 "-I." "-Ilibs\gil\test" 
2022-04-09T12:28:12.0987978Z 
2022-04-09T12:28:12.0988464Z ...failed compile-c-c++ bin.v2\libs\gil\test\core\histogram\fill.test\msvc-14.3\dbg\adrs-mdl-32\cxstd-ltst-iso\thrd-mlt\fill.obj...

Assuming libs\gil\test\core\histogram\fill.cpp(64) means line 64, bug must be coming from the vectors of bool here:

std::vector<std::vector<bool>> mask =
{
{1, 0, 0, 1},
{0, 0, 1, 1},
{0, 1, 0, 1},
{1, 1, 0, 0},
};

@codejaeger since it's your code, before I jump in modifying it myself, would you have any suggestions/preferences?

Some ideas:

  1. Replace std::vector<std::vector<bool>> with linear std::vector<bool> or std::bitset
  2. Introduce mask_2d and mask_2d_fixed adapting linear std::vector<bool>, like kernel_2d

C++ Minimal Working Example

// cl /std:c++latest /EHsc /MDd /D_DEBUG test.cpp
#include <vector>

std::vector<std::vector<bool>> mask =
{
    {1, 0, 0, 1},
    {0, 0, 1, 1},
    {0, 1, 0, 1},
    {1, 1, 0, 0},
};

int main()
{
    return 0;
}

image

@mloskot mloskot added cat/annoyance Not a bug, not a feature, but something that should be improved core boost/gil labels Apr 12, 2022
@sdebionne
Copy link
Contributor

I notice that only debug builds fail, aka cl /std:c++latest /EHsc test.cpp compiles.

@sdebionne
Copy link
Contributor

This bug report Regression default-initializing static duration array of vectors in C++latest debug mode is a close match.

Which make me wonder why use /std:c++latest? Isn't this asking for troubles 😀 ?

@mloskot
Copy link
Member Author

mloskot commented Apr 12, 2022

FYI, I reported the issue here, https://developercommunity.visualstudio.com/t/INTERNAL-COMPILER-ERROR-compiling-std::v/10011526

Which make me wonder why use /std:c++latest? Isn't this asking for troubles 😀 ?

Yes, /std:c++latest needs to be disabled.
This is aligned with the grand plan as discussed in #642 (comment)

mloskot added a commit that referenced this issue Apr 12, 2022
This should work around the Internal Compiler Error
due to std::vector<std::vector<bool>>, see
#645
@mloskot
Copy link
Member Author

mloskot commented Apr 28, 2022

FYI, I reported the issue here, https://developercommunity.visualstudio.com/t/INTERNAL-COMPILER-ERROR-compiling-std::v/10011526

Latest update: "A fix for this issue has been internally implemented and is being prepared for release. "

@striezel
Copy link
Contributor

striezel commented Jul 16, 2023

According to https://developercommunity.visualstudio.com/t/INTERNAL-COMPILER-ERROR-compiling-std::v/10011526#T-N10277969 this should be fixed by now:

A fix for this issue has been released! Install the most recent release from https://visualstudio.microsoft.com/downloads/. Thank you for providing valuable feedback which has helped improve the product.

Unfortunately, it does not say which versions of MSVC contain the fix. So somebody might still need to confirm that this is fixed for the versions used in the CI jobs.

Edit: Oh wait ... it says "Fixed In: Visual Studio 2022 version 17.3", so it should at least work for the windows-2022 image in CI, because that is using VS 17.6.33815.320 at the moment. (See https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat/annoyance Not a bug, not a feature, but something that should be improved core boost/gil
Projects
None yet
Development

No branches or pull requests

3 participants