circumvent gcc-8 strict aliasing warning

because gcc considers that
`void* const *`  and `void**` are 2 different types ...
This commit is contained in:
Yann Collet 2018-11-13 16:04:35 -08:00
parent 3ba0d6dd27
commit 975abf8f5d

View File

@ -515,6 +515,7 @@ static size_t benchMem(U32 benchNb,
/* benchmark loop */
{ BMK_timedFnState_t* const tfs = BMK_createTimedFnState(g_nbIterations * 1000, 1000);
void* const avoidStrictAliasingPtr = &dstBuff;
BMK_benchParams_t bp;
BMK_runTime_t bestResult;
bestResult.sumOfReturn = 0;
@ -529,12 +530,13 @@ static size_t benchMem(U32 benchNb,
bp.blockCount = 1;
bp.srcBuffers = &src;
bp.srcSizes = &srcSize;
bp.dstBuffers = (void* const*) &dstBuff;
bp.dstBuffers = (void* const*) avoidStrictAliasingPtr; /* circumvent strict aliasing warning on gcc-8,
* because gcc considers that `void* const *` and `void**` are 2 different types */
bp.dstCapacities = &dstBuffSize;
bp.blockResults = NULL;
for (;;) {
BMK_runOutcome_t const bOutcome = BMK_benchTimedFn( tfs, bp);
BMK_runOutcome_t const bOutcome = BMK_benchTimedFn(tfs, bp);
if (!BMK_isSuccessful_runOutcome(bOutcome)) {
DISPLAY("ERROR benchmarking function ! ! \n");