classification
Title: _pickle build warnings on Fedora 19
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ncoghlan, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2013-11-03 06:31 by ncoghlan, last changed 2020-02-12 01:24 by vstinner. This issue is now closed.

Messages (4)
msg201997 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-11-03 06:31
Currently getting build warnings from _pickle.c:
==========================
building '_pickle' extension
gcc -pthread -fPIC -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -IInclude -I/usr/local/include -I/home/ncoghlan/devel/py3k/Include -I/home/ncoghlan/devel/py3k -c /home/ncoghlan/devel/py3k/Modules/_pickle.c -o build/temp.linux-x86_64-3.4/home/ncoghlan/devel/py3k/Modules/_pickle.o
/home/ncoghlan/devel/py3k/Modules/_pickle.c: In function ‘load_counted_long’:
/home/ncoghlan/devel/py3k/Modules/_pickle.c:4143:15: warning: ‘pdata’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         value = _PyLong_FromByteArray((unsigned char *)pdata, (size_t)size,
               ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c: In function ‘load’:
/home/ncoghlan/devel/py3k/Modules/_pickle.c:5330:25: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     i = (unsigned char)s[0];
                         ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c:5324:11: note: ‘s’ was declared here
     char *s;
           ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c:4995:30: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     idx = Py_CHARMASK(s[0]);
                              ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c:4986:11: note: ‘s’ was declared here
     char *s;
           ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c:4005:20: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     x |= (size_t) s[3] << 24;
                    ^
/home/ncoghlan/devel/py3k/Modules/_pickle.c:4858:11: note: ‘s’ was declared here
     char *s;
           ^
gcc -pthread -shared build/temp.linux-x86_64-3.4/home/ncoghlan/devel/py3k/Modules/_pickle.o -L/usr/local/lib -o build/lib.linux-x86_64-3.4/_pickle.cpython-34m.so
==========================
msg228395 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-10-03 22:15
Still a problem or out of date?
msg228430 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-04 06:58
They all look as false positive. For example:

        if (_Unpickler_Read(self, &pdata, size) < 0)
            return -1;
        value = _PyLong_FromByteArray((unsigned char *)pdata, (size_t)size,
                                      1 /* little endian */ , 1 /* signed */ );

gcc is enough smart to determine that pdata can be not initialized in _Unpickler_Read(), but not enough smart to determine that in this case _Unpickler_Read() always returns -1.
msg361856 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-12 01:24
I don't get these warnings on Fedora anymore. I close the issue.
History
Date User Action Args
2020-02-12 01:24:37vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg361856

resolution: fixed
stage: needs patch -> resolved
2019-04-26 18:04:22BreamoreBoysetnosy: - BreamoreBoy
2014-10-04 06:58:49serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg228430
2014-10-03 22:15:44BreamoreBoysetnosy: + BreamoreBoy
messages: + msg228395
2013-11-03 06:31:23ncoghlancreate