<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - kmp_settings.cpp fails to compile on Windows with error C2131: expression did not evaluate to a constant"
   href="https://bugs.llvm.org/show_bug.cgi?id=48919">48919</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>kmp_settings.cpp fails to compile on Windows with error C2131: expression did not evaluate to a constant
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>48902
          </td>
        </tr></table>
      <p>
        <div>
        <pre>in a VS 2019 x86 Native Tools Command Prompt

with llvmorg-12.0.0-rc1 checked out

cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_ENABLE_PROJECTS="clang;openmp" ..\llvm
ninja omp

C:\src\llvm.monorepo\openmp\runtime\src\kmp_settings.cpp(3358): error C2131:
expression did not evaluate to a constant
C:\src\llvm.monorepo\openmp\runtime\src\kmp_settings.cpp(3358): note: failure
was caused by a read of a variable outside its lifetime
C:\src\llvm.monorepo\openmp\runtime\src\kmp_settings.cpp(3358): note: see usage
of 'ntraits'


Bisection points to


commit 927af4b3c57681e623b8449fb717a447559358d0
Author: Nawrin Sultana <<a href="mailto:nawrin.sultana@intel.com">nawrin.sultana@intel.com</a>>
Date:   Mon Nov 2 16:17:37 2020 -0600

    [OpenMP] Modify OMP_ALLOCATOR environment variable

    This patch sets the def-allocator-var ICV based on the environment
variables
    provided in OMP_ALLOCATOR. Previously, only allowed value for OMP_ALLOCATOR
    was a predefined memory allocator. OpenMP 5.1 specification allows
predefined
    memory allocator, predefined mem space, or predefined mem space with traits
in
    OMP_ALLOCATOR. If an allocator can not be created using the provided
environment
    variables, the def-allocator-var is set to omp_default_mem_alloc.

    Differential Revision: <a href="https://reviews.llvm.org/D94985">https://reviews.llvm.org/D94985</a>

 openmp/runtime/src/kmp_settings.cpp       | 391 ++++++++++++++++++++++++------
 openmp/runtime/test/env/omp51_alloc_env.c |  31 +++
 2 files changed, 353 insertions(+), 69 deletions(-)
 create mode 100644 openmp/runtime/test/env/omp51_alloc_env.c



As of this morning the same error happens on the main branch too.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [meta] 12.0.0 Release Blockers"
   href="https://bugs.llvm.org/show_bug.cgi?id=48902">Bug 48902</a>] [meta] 12.0.0 Release Blockers
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>