Skip to content

Commit eaed381

Browse files
authored
Partially fix test failures with libstdc++ 15 in debug mode (#259)
When compiling on Fedora 42, there are now test failures in debug mode (see llvm/llvm-project#144678). This PR fixes the test-failures for all tests but CLAMR where I couldn't figure out what the problem actually is and the code in the upstream repo seems substantially different now.
1 parent 2720be4 commit eaed381

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

MultiSource/Benchmarks/DOE-ProxyApps-C++/PENNANT/Mesh.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,19 @@ void Mesh::initInvMap() {
273273
sort(pcpair.begin(), pcpair.end());
274274
for (int i = 0; i < numc; ++i) {
275275
int p = pcpair[i].first;
276-
int pp = pcpair[i+1].first;
277-
int pm = 0;
278-
// pm is only used when i != 0
279-
if(i != 0)
280-
pm = pcpair[i-1].first;
281276
int c = pcpair[i].second;
282-
int cp = pcpair[i+1].second;
283277

284-
if (i == 0 || p != pm) mappcfirst[p] = c;
285-
if (i+1 == numc || p != pp)
286-
mapccnext[c] = -1;
287-
else
288-
mapccnext[c] = cp;
278+
if (i == 0) mappcfirst[p] = c;
279+
else {
280+
int pm = pcpair[i-1].first;
281+
if (p != pm) mappcfirst[p] = c;
282+
}
283+
mapccnext[c] = -1;
284+
if (i+1 != numc) {
285+
int pp = pcpair[i+1].first;
286+
int cp = pcpair[i+1].second;
287+
if (p == pp) mapccnext[c] = cp;
288+
}
289289
}
290290

291291
}

MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/MatrixInitOp.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ struct MatrixInitOp<miniFE::CSRMatrix<MINIFE_SCALAR,MINIFE_LOCAL_ORDINAL,MINIFE_
7676
mesh(&input_mesh),
7777
dest_rows(&matrix.rows[0]),
7878
dest_rowoffsets(&matrix.row_offsets[0]),
79-
dest_cols(&matrix.packed_cols[0]),
80-
dest_coefs(&matrix.packed_coefs[0]),
8179
n(matrix.rows.size())
8280
{
8381
if (matrix.packed_cols.capacity() != matrix.packed_coefs.capacity()) {
@@ -93,6 +91,9 @@ struct MatrixInitOp<miniFE::CSRMatrix<MINIFE_SCALAR,MINIFE_LOCAL_ORDINAL,MINIFE_
9391

9492
matrix.packed_cols.resize(nnz);
9593
matrix.packed_coefs.resize(nnz);
94+
95+
dest_cols = matrix.packed_cols.data();
96+
dest_coefs = matrix.packed_coefs.data();
9697
dest_rowoffsets[n] = nnz;
9798
#ifdef HAVE_MPI
9899
MPI_Comm_rank(MPI_COMM_WORLD, &proc);

SingleSource/UnitTests/Vectorizer/common.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,17 @@ static std::mt19937 rng;
6666
// Initialize arrays A with random numbers.
6767
template <typename Ty>
6868
static void init_data(const std::unique_ptr<Ty[]> &A, unsigned N) {
69-
std::uniform_int_distribution<uint64_t> distrib(
70-
std::numeric_limits<Ty>::min(), std::numeric_limits<Ty>::max());
71-
for (unsigned i = 0; i < N; i++)
72-
A[i] = distrib(rng);
69+
if constexpr (std::is_floating_point_v<Ty>) {
70+
std::uniform_real_distribution<Ty> distrib(
71+
std::numeric_limits<Ty>::min(), std::numeric_limits<Ty>::max());
72+
for (unsigned i = 0; i < N; i++)
73+
A[i] = distrib(rng);
74+
} else {
75+
std::uniform_int_distribution<Ty> distrib(
76+
std::numeric_limits<Ty>::min(), std::numeric_limits<Ty>::max());
77+
for (unsigned i = 0; i < N; i++)
78+
A[i] = distrib(rng);
79+
}
7380
}
7481

7582
template <typename Ty>

SingleSource/UnitTests/matrix-types-spec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ int main(void) {
211211
testTranspose<double, 3, 10>();
212212
testTranspose<double, 4, 3>();
213213
testTranspose<float, 31, 17>();
214-
testTranspose<unsigned, 8, 7>();
214+
testTranspose<signed, 8, 7>();
215215

216216
testMultiply<double, 3, 3, 3>();
217217
testMultiply<double, 10, 21, 23>();

0 commit comments

Comments
 (0)