This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: warning: dereferencing type-punned pointer will break strict-aliasing rules
Type: compile error Stage: patch review
Components: Extension Modules Versions: Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: 16113 Superseder:
Assigned To: Nosy List: christian.heimes, ekul, mark.dickinson, masamoto, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-09-13 07:11 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
keccak_warnings.patch serhiy.storchaka, 2016-09-27 20:35 review
Messages (5)
msg276193 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-13 07:11
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;
     ^
msg276210 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-13 08:15
The compile warning occurs on 32bit builds only: http://buildbot.python.org/all/builders/x86%20Gentoo%20Non-Debug%20with%20X%203.x
msg277546 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-27 20:35
Proposed patch eliminates warnings.
msg306005 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2017-11-10 04:09
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.
msg326439 - (view) Author: ekul (ekul) Date: 2018-09-26 10:24
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.
History
Date User Action Args
2022-04-11 14:58:36adminsetgithub: 72304
2018-09-26 10:24:44ekulsetnosy: + ekul
messages: + msg326439
2017-11-10 04:09:17masamotosetnosy: + masamoto
messages: + msg306005
2016-09-27 20:35:34serhiy.storchakasetfiles: + keccak_warnings.patch
keywords: + patch
messages: + msg277546

stage: needs patch -> patch review
2016-09-13 08:15:15christian.heimessetmessages: + msg276210
2016-09-13 07:17:48christian.heimessetdependencies: + Add SHA-3 and SHAKE (Keccak) support
stage: needs patch
2016-09-13 07:11:54serhiy.storchakacreate