<html>#2548: Compilation failure: "const" assignment in LoopControl/src/loopcontrol.cc
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Bernard Kelly</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td>ET_2021_05</td></tr>
<tr><td style='text-align:right'>  Version:</td><td>ET_2021_05</td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>blocker</td></tr>
<tr><td style='text-align:right'>Component:</td><td>EinsteinToolkit thorn</td></tr>
</table>

<p>Changes (by Bernard Kelly):</p>
<p>Fresh download &amp; first compilation of the latest ETK release. Compilation fails during LoopControl because a dynamic variable is used to set a const constexpr parameter “lc_random_range”. Here’s the error message:</p>
<p><code>COMPILING Carpet/LoopControl/src/loopcontrol.cc /gpfs/scratch/bjk0015/codes/Cactus_ET_2021_05/arrangements/Carpet/LoopControl/src/loopcontrol.cc(70): error: function call must have a constant value in a constant expression lc_random.max() - lc_random.min() + 1; ^</code></p>
<p><code>/gpfs/scratch/bjk0015/codes/Cactus_ET_2021_05/arrangements/Carpet/LoopControl/src/loopcontrol.cc(70): error: function call must have a constant value in a constant expression lc_random.max() - lc_random.min() + 1;</code></p>
<p>… though it’s useful to see the full assignment, which begins the line before (line 69):</p>
<p><code>minstd_rand::result_type const constexpr lc_random_range = lc_random.max() - lc_random.min() + 1;</code></p>
<p>Fix: take out the “const” and “constexpr” descriptors from the lc_random_range declaration. git diff is attached.</p>
<p>Further notes:</p>
<p>The compilation is on the WVU machine Spruce Knob, using the Intel 17.0.1 compiler. I’m using the following configuration options:</p>
<p>CC=icc</p>
<p>CFLAGS=-Ofast -qopenmp -xHost  -align -std=gnu99</p>
<p>CPP=cpp</p>
<p>CPPFLAGS=-DMPICH_IGNORE_CXX_SEEK</p>
<p>CPP_DEBUG_FLAGS=-DCARPET_DEBUG</p>
<p>CPP_OPENMP_FLAGS=-fopenmp</p>
<p>CROSS_COMPILE=yes</p>
<p>CXX=icpc</p>
<p>CXXFLAGS=-Ofast -qopenmp -xHost  -align -std=gnu++11</p>
<p>CXX_DEBUG_FLAGS=-O0</p>
<p>CXX_NO_OPTIMISE_FLAGS=-O0</p>
<p>CXX_OPENMP_FLAGS=-fopenmp</p>
<p>CXX_OPTIMISE_FLAGS=-Ofast</p>
<p>CXX_PROFILE_FLAGS=-pg</p>
<p>C_DEBUG_FLAGS=-O0</p>
<p>C_LINE_DIRECTIVES=yes</p>
<p>C_NO_OPTIMISE_FLAGS=-O0</p>
<p>C_OPENMP_FLAGS=-fopenmp</p>
<p>C_OPTIMISE_FLAGS=-Ofast</p>
<p>C_PROFILE_FLAGS=-pg</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2548/compilation-failure-const-assignment-in'>https://bitbucket.org/einsteintoolkit/tickets/issues/2548/compilation-failure-const-assignment-in</a></p>
</html>