You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
warning: dereferencing type-punned pointer will break strict-aliasing rules #72304
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;
^
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.
ekul00 commented on Sep 26, 2018
ekul00mannequin
Mannequin
More actions
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.
Modules/_sha3/kcp/ no longer exists: the Keccak Code Package was replaced with tiny_sha3 in bpo-47098 (GH-32060), and SHA-3 is now implemented with HACL*. The warning is gone with the code that caused it.
Activity
serhiy-storchaka commentedon Sep 13, 2016
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;
^
tiran commentedon 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
serhiy-storchaka commentedon Sep 27, 2016
Proposed patch eliminates warnings.
ma8ma commentedon Nov 10, 2017
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.
ekul00 commentedon Sep 26, 2018
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.
serhiy-storchaka commentedon Aug 5, 2026
Modules/_sha3/kcp/no longer exists: the Keccak Code Package was replaced with tiny_sha3 in bpo-47098 (GH-32060), and SHA-3 is now implemented with HACL*. The warning is gone with the code that caused it.