locked
Regression in Visual Studio 2015 Update 1 RRS feed

  • Question

  • Hi,

    We are seeing C++ code that compiled without issue under Visual Studio 2015 crash the compiler when Update 1 is applied. The following code is a simplified version from our codebase that crashes while compiling under Debug mode for amd64. It is fine in release mode. The /openmp compiler flag is required.

    #include <algorithm>
    #include <vector>
    
    #define PRAGMA __pragma
    #define PRAGMA_OMP(expression) PRAGMA(omp expression)
    #define PARALLEL_SECTIONS PRAGMA(omp parallel sections)
    #define PARALLEL_SECTION PRAGMA(omp section)
    
    template <typename T>
    void parallel_scale2(std::vector<T> &vec) {
        size_t size = vec.size();
        typename std::vector<T>::iterator begin = vec.begin();
        typename std::vector<T>::iterator middle = begin + size / 2;
        typename std::vector<T>::iterator end = vec.end();
    
        PARALLEL_SECTIONS
        {
            PARALLEL_SECTION
            {
                std::transform(begin, middle, begin,
                    [](typename T x) { return 2.0 * x; });
            }
            PARALLEL_SECTION
            {
                std::transform(middle, end, middle,
                    [](typename T x) { return 2.0 * x; });
            }
        }
    }
    
    int main() {
        std::vector<int> values{ 10,9,8,7,6,5,4 };
        parallel_scale2(values);
    }

    If you replace the macros with the full #pragma omp parallel statements then the code compiles successfully.

    Is this not valid code any longer?



    • Edited by Martyn G Friday, December 4, 2015 9:18 AM Add compiler flag
    Friday, December 4, 2015 9:13 AM

Answers

  • We are seeing C++ code that compiled without issue under Visual Studio 2015 crash the compiler when Update 1 is applied. The following code is a simplified version from our codebase that crashes while compiling under Debug mode for amd64. It is fine in release mode. The /openmp compiler flag is required.

    Does it look like the following?

    /*
    
    Compiled with /openmp /EHsc /nologo /W4 /c
    main.cpp
    main.cpp(29): fatal error C1001: An internal error has occurred in the compiler.
    (compiler file 'msc1.cpp', line 1428)
     To work around this problem, try simplifying or changing the program near the locations listed above.
    Please choose the Technical Support command on the Visual C++ 
     Help menu, or open the Technical Support help file for more information
    main.cpp(33): note: see reference to function template instantiation 'void parallel_scale2<int>(std::vector<int,std::allocator<_Ty>> &)' being compiled
            with
            [
                _Ty=int
            ]
    Internal Compiler Error in c:\tools_root\cl\bin\i386\cl.exe.  You will be prompted to send an error report to Microsoft later.
    INTERNAL COMPILER ERROR in 'c:\tools_root\cl\bin\i386\cl.exe'
        Please choose the Technical Support command on the Visual C++
        Help menu, or open the Technical Support help file for more information
    
    */

    This is from a compile using

    Compiler version: 19.00.23602.0(x86). Last updated: Dec 3, 2015

    at:

    http://webcompiler.cloudapp.net/

    I suggest you submit this at:

    https://connect.microsoft.com/VisualStudio

    - Wayne

    • Proposed as answer by May Wang - MSFT Monday, December 7, 2015 5:13 AM
    • Marked as answer by Martyn G Monday, December 7, 2015 8:07 AM
    Friday, December 4, 2015 1:21 PM

All replies

  • We are seeing C++ code that compiled without issue under Visual Studio 2015 crash the compiler when Update 1 is applied. The following code is a simplified version from our codebase that crashes while compiling under Debug mode for amd64. It is fine in release mode. The /openmp compiler flag is required.

    Does it look like the following?

    /*
    
    Compiled with /openmp /EHsc /nologo /W4 /c
    main.cpp
    main.cpp(29): fatal error C1001: An internal error has occurred in the compiler.
    (compiler file 'msc1.cpp', line 1428)
     To work around this problem, try simplifying or changing the program near the locations listed above.
    Please choose the Technical Support command on the Visual C++ 
     Help menu, or open the Technical Support help file for more information
    main.cpp(33): note: see reference to function template instantiation 'void parallel_scale2<int>(std::vector<int,std::allocator<_Ty>> &)' being compiled
            with
            [
                _Ty=int
            ]
    Internal Compiler Error in c:\tools_root\cl\bin\i386\cl.exe.  You will be prompted to send an error report to Microsoft later.
    INTERNAL COMPILER ERROR in 'c:\tools_root\cl\bin\i386\cl.exe'
        Please choose the Technical Support command on the Visual C++
        Help menu, or open the Technical Support help file for more information
    
    */

    This is from a compile using

    Compiler version: 19.00.23602.0(x86). Last updated: Dec 3, 2015

    at:

    http://webcompiler.cloudapp.net/

    I suggest you submit this at:

    https://connect.microsoft.com/VisualStudio

    - Wayne

    • Proposed as answer by May Wang - MSFT Monday, December 7, 2015 5:13 AM
    • Marked as answer by Martyn G Monday, December 7, 2015 8:07 AM
    Friday, December 4, 2015 1:21 PM
  • Hi Wayne,

    Yes, that's the error. I will submit feedback as you suggest.

    Martyn

    Monday, December 7, 2015 8:07 AM