Skip to content

Commit 5f1033d

Browse files
committed
Suppress stringop-overflow warning due to GCC 11 regression
Signed-off-by: Matthew Cong <[email protected]>
1 parent e48a8f8 commit 5f1033d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

nanovdb/nanovdb/NanoVDB.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,15 +3217,18 @@ struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT) InternalData
32173217
__hostdev__ const StatsT& average() const { return mAverage; }
32183218
__hostdev__ const StatsT& stdDeviation() const { return mStdDevi; }
32193219

3220-
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3220+
// GCC 11 (and possibly prior versions) has a regression that results in invalid
3221+
// warnings when -Wstringop-overflow is turned on. For details, refer to
3222+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
3223+
#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
32213224
#pragma GCC diagnostic push
32223225
#pragma GCC diagnostic ignored "-Wstringop-overflow"
32233226
#endif
32243227
__hostdev__ void setMin(const ValueT& v) { mMinimum = v; }
32253228
__hostdev__ void setMax(const ValueT& v) { mMaximum = v; }
32263229
__hostdev__ void setAvg(const StatsT& v) { mAverage = v; }
32273230
__hostdev__ void setDev(const StatsT& v) { mStdDevi = v; }
3228-
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3231+
#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
32293232
#pragma GCC diagnostic pop
32303233
#endif
32313234

@@ -3662,10 +3665,20 @@ struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT) LeafData
36623665
__hostdev__ FloatType getAvg() const { return mAverage; }
36633666
__hostdev__ FloatType getDev() const { return mStdDevi; }
36643667

3668+
// GCC 11 (and possibly prior versions) has a regression that results in invalid
3669+
// warnings when -Wstringop-overflow is turned on. For details, refer to
3670+
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
3671+
#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3672+
#pragma GCC diagnostic push
3673+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
3674+
#endif
36653675
__hostdev__ void setMin(const ValueType& v) { mMinimum = v; }
36663676
__hostdev__ void setMax(const ValueType& v) { mMaximum = v; }
36673677
__hostdev__ void setAvg(const FloatType& v) { mAverage = v; }
36683678
__hostdev__ void setDev(const FloatType& v) { mStdDevi = v; }
3679+
#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3680+
#pragma GCC diagnostic pop
3681+
#endif
36693682

36703683
template<typename T>
36713684
__hostdev__ void setOrigin(const T& ijk) { mBBoxMin = ijk; }

0 commit comments

Comments
 (0)