#2548: Compilation failure: "const" assignment in LoopControl/src/loopcontrol.cc
Reporter: Bernard Kelly Status: new Milestone: ET_2021_05 Version: ET_2021_05 Type: bug Priority: blocker Component: EinsteinToolkit thorn
Changes (by Bernard Kelly): Fresh download & 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:
`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; ^`
`/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;`
… though it’s useful to see the full assignment, which begins the line before (line 69):
`minstd_rand::result_type const constexpr lc_random_range = lc_random.max() - lc_random.min() + 1;`
Fix: take out the “const” and “constexpr” descriptors from the lc_random_range declaration. git diff is attached.
Further notes:
The compilation is on the WVU machine Spruce Knob, using the Intel 17.0.1 compiler. I’m using the following configuration options:
CC=icc
CFLAGS=-Ofast -qopenmp -xHost -align -std=gnu99
CPP=cpp
CPPFLAGS=-DMPICH_IGNORE_CXX_SEEK
CPP_DEBUG_FLAGS=-DCARPET_DEBUG
CPP_OPENMP_FLAGS=-fopenmp
CROSS_COMPILE=yes
CXX=icpc
CXXFLAGS=-Ofast -qopenmp -xHost -align -std=gnu++11
CXX_DEBUG_FLAGS=-O0
CXX_NO_OPTIMISE_FLAGS=-O0
CXX_OPENMP_FLAGS=-fopenmp
CXX_OPTIMISE_FLAGS=-Ofast
CXX_PROFILE_FLAGS=-pg
C_DEBUG_FLAGS=-O0
C_LINE_DIRECTIVES=yes
C_NO_OPTIMISE_FLAGS=-O0
C_OPENMP_FLAGS=-fopenmp
C_OPTIMISE_FLAGS=-Ofast
C_PROFILE_FLAGS=-pg
-- Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2548/compilation-failur...
trac@lists.einsteintoolkit.org