Skip to content

Commit

Permalink
Avoid clang warning in -fsanitize=undefined -O mode (master only)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 13, 2025
1 parent 926f93b commit 1107465
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gcore/rasterio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5944,6 +5944,11 @@ __attribute__((optimize("tree-vectorize")))
#if defined(__GNUC__)
__attribute__((noinline))
#endif
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
// clang++ -O2 -fsanitize=undefined fails to vectorize, ignore that warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpass-failed"
#endif
static void
GDALInterleave2Byte(const uint8_t *CPL_RESTRICT pSrc,
uint8_t *CPL_RESTRICT pDst, size_t nIters)
Expand All @@ -5957,6 +5962,9 @@ GDALInterleave2Byte(const uint8_t *CPL_RESTRICT pSrc,
pDst[2 * i + 1] = pSrc[i + 1 * nIters];
}
}
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
#pragma clang diagnostic pop
#endif

#endif

Expand Down Expand Up @@ -6039,6 +6047,11 @@ __attribute__((optimize("tree-vectorize")))
#if defined(__GNUC__)
__attribute__((noinline))
#endif
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
// clang++ -O2 -fsanitize=undefined fails to vectorize, ignore that warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpass-failed"
#endif
static void
GDALInterleave4Byte(const uint8_t *CPL_RESTRICT pSrc,
uint8_t *CPL_RESTRICT pDst, size_t nIters)
Expand All @@ -6054,6 +6067,9 @@ GDALInterleave4Byte(const uint8_t *CPL_RESTRICT pSrc,
pDst[4 * i + 3] = pSrc[i + 3 * nIters];
}
}
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
#pragma clang diagnostic pop
#endif

#endif

Expand Down
8 changes: 8 additions & 0 deletions gcore/rasterio_ssse3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ __attribute__((optimize("tree-vectorize")))
#if defined(__GNUC__)
__attribute__((noinline))
#endif
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
// clang++ -O2 -fsanitize=undefined fails to vectorize, ignore that warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpass-failed"
#endif
static void
GDALInterleave3Byte_SSSE3(const uint8_t *CPL_RESTRICT pSrc,
uint8_t *CPL_RESTRICT pDst, size_t nIters)
Expand All @@ -434,6 +439,9 @@ GDALInterleave3Byte_SSSE3(const uint8_t *CPL_RESTRICT pSrc,
pDst[3 * i + 2] = pSrc[i + 2 * nIters];
}
}
#if defined(__clang__) && !defined(__INTEL_CLANG_COMPILER)
#pragma clang diagnostic pop
#endif

#endif

Expand Down

0 comments on commit 1107465

Please sign in to comment.