Repository navigation
warning: dereferencing type-punned pointer will break strict-aliasing rules #72304
Description
Activity
In file included from /home/serhiy/py/cpython/Modules/_sha3/sha3module.c:113:0:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_SetBytesInLaneToZero’:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:97:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
low = *((UINT32*)(laneAsBytes+0));
^
In file included from /home/serhiy/py/cpython/Modules/_sha3/sha3module.c:113:0:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_AddBytesInLane’:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:152:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
low = *((UINT32*)(laneAsBytes+0));
^
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_ExtractBytesInLane’:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:296:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*((UINT32*)(laneAsBytes+0)) = low;
^
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_ExtractAndAddBytesInLane’:
/home/serhiy/py/cpython/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:369:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*((UINT32*)(laneAsBytes+0)) = low;
^- added3.7 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirbuildThe build process and cross-buildThe build process and cross-build
on Sep 13, 2016 The compile warning occurs on 32bit builds only: http://buildbot.python.org/all/builders/x86%20Gentoo%20Non-Debug%20with%20X%203.x
Proposed patch eliminates warnings.
Serhiy, would you open a PR? Your patch looks good to me.
I've been looking at the warning on my machine (ubuntu 16.04 x86), it's a bit annoying to me.I just got this set of warnings while building 3.6.6 on RasPi Debian9/ARM. Good to know the warning is spurious.
Just finding my way here - is Serhiy's patch above a working 2016 fix for this that got stuck in review? I couldn't find a PR for it. If the warning _is_ spurious it would be great to patch it.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: