Skip to content

Commit 6a1e86e

Browse files
committed
[Minuit2] Use signed integer as index variable in OpenMP 'for' statement
Compiling Minuit2 with `minuit2_omp=ON` when using MVSC raises `error C3016: 'i': index variable in OpenMP 'for' statement must have signed integral type` Source of the error is line 102 in `math/minuit2/src/Numerical2PGradientCalculator.cxx` where (in commit 95035e2) the for-loop variable type was changed from integer to unsigned integer. While this is no problem for GCC, MVSC apparently strictly forbids this. Closes #20586.
1 parent 8a4a8cb commit 6a1e86e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

math/minuit2/src/Numerical2PGradientCalculator.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ operator()(const MinimumParameters &par, const FunctionGradient &Gradient) const
9999
#pragma omp parallel for if (fDoParallelOMP)
100100
//#pragma omp for schedule (static, N_PARALLEL_PAR)
101101

102-
for (unsigned int i = 0; i < n; i++) {
102+
// Note: the MSVC compiler enforces that the index variable in OpenMP 'for'
103+
// statements must have signed int type!
104+
for (int i = 0; i < int(n); i++) {
103105

104106
#endif
105107

0 commit comments

Comments
 (0)