aresch / rencode

Python module for fast (basic) object serialization similar to bencode
GNU General Public License v3.0
29 stars 7 forks source link

Pointer aliasing warnings during build #17

Closed jonathanunderwood closed 5 years ago

jonathanunderwood commented 6 years ago

Building on Fedora raises some warnings about pointer aliasing:

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/include/python2.7 -c rencode/rencode.c -o build/temp.linux-x86_64-2.7/rencode/rencode.o -O3
In file included from /usr/include/python2.7/Python.h:83,
                 from rencode/rencode.c:4:
rencode/rencode.c: In function 'init_rencode':
/usr/include/python2.7/object.h:769:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((PyObject*)(op))->ob_refcnt++)
     ~^~~~~~~~~~~~~~~~
rencode/rencode.c:867:27: note: in expansion of macro 'Py_INCREF'
   #define __Pyx_INCREF(r) Py_INCREF(r)
                           ^~~~~~~~~
rencode/rencode.c:8416:3: note: in expansion of macro '__Pyx_INCREF'
   __Pyx_INCREF(Py_False);
   ^~~~~~~~~~~~
/usr/include/python2.7/object.h:769:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((PyObject*)(op))->ob_refcnt++)
     ~^~~~~~~~~~~~~~~~
rencode/rencode.c:867:27: note: in expansion of macro 'Py_INCREF'
   #define __Pyx_INCREF(r) Py_INCREF(r)
                           ^~~~~~~~~
rencode/rencode.c:8428:3: note: in expansion of macro '__Pyx_INCREF'
   __Pyx_INCREF(Py_False);
   ^~~~~~~~~~~~
/usr/include/python2.7/object.h:769:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((PyObject*)(op))->ob_refcnt++)
     ~^~~~~~~~~~~~~~~~
rencode/rencode.c:867:27: note: in expansion of macro 'Py_INCREF'
   #define __Pyx_INCREF(r) Py_INCREF(r)
                           ^~~~~~~~~
rencode/rencode.c:8468:5: note: in expansion of macro '__Pyx_INCREF'
     __Pyx_INCREF(Py_True);
     ^~~~~~~~~~~~
aresch commented 6 years ago

What version of cython are you using?

cython --version
jonathanunderwood commented 5 years ago

I haven't been able to reproduce this lately, unfortunately. I suspect that moving to building from the .pyx and regenerating the .c file fixed it. Will close this.