When compiling the 29Aug2024 version using icpc 19.0.1, I encounter an error in fmt/format.h, line 1401: “fmt/format.h(1401): error: variable “buffer” may not be initialized”
This line reads:
Char buffer[digits10() + 1] = {};
whereas in older versions of LAMMPS it read
Char buffer[digits10() + 1];
and compiled without issue. Interestingly, almost the same allocation occurs on line 2626, but there the assignment “= {}” was not added in the latest LAMMPS version and hence that line does not generate an error message.
I am guessing this problem is related to C++ not allowing variable-length arrays. I use compiler options “-restrict -std=c++11”. Compiling the same code with GCC works without errors.
Is there an oversight on my part, or is this a compiler problem?
This part of the source code is part of libfmt version 10.2.1 which is bundled with LAMMPS.
You are guessing wrong, since this is not a variable length array. The digits10() function is declared as constexpr and thus evaluated at compile time. See line 1314.
My money would be on “compiler problem”. Version 19.0 dates back to April 3, 2018. Many Intel compiler x.0 versions in the past had problems with different parts of LAMMPS (and libfmt).
We are currently testing compilation of LAMMPS against Intel classic compiler version 19.1.2 and there is no indication of a problem compiling LAMMPS and libfmt.