Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51912

[Tooling] MSVC v19.16 contains bug that causes a complier to crash

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None
    • 1

    Description

      MSVC v19.16 and below contain a compiler bug that means we can't use a const char* template pram inside a template at run time. This affects our Monotonic<> in monotonic.h, as we use the Name template argument when throwing an exception if the assignment ins't monotonic.

      When compiling with MSVC v19.16 we observe the following:

      <source>(224): fatal error C1001: An internal error has occurred in the compiler.
      (compiler file 'd:\agent\_work\4\s\src\vctools\compiler\cxxfe\sl\p1\c\symbols.c', line 29788)
       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
      

      An example of the issue can be seen here:https://godbolt.org/z/6nsP3n5s9, this also demonstrates that the bug is fixed in MSVC v19.20 and above.

      Fix:

      In the log run we should update MSVC to get the bug fix, this will be done under MB-43718.

      But for now perform a temporary fix for monotonic.h to if define out the usage of Name template pram for MSVC v19.16 and below.
      This means the Name label will not be used when throwing and will display as:

      Monotonic<unsigned __int64> (unlabelled) invariant failed: new value (0) breaks invariant on current value (2)
      

      Any other compiler will produce the following:

      Monotonic<unsigned __int64> (am2) invariant failed: new value (0) breaks invariant on current value (2)
      

      We should remove this if def after we have upgrade to MSVC v19.20 or greater

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owend Daniel Owen
            richard.demellow Richard deMellow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty