boostorg / boostorg/python

Strict aliasing rule violations with python2.7

Aberta
#179 2 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
537
Forks
223
Merge médio
11h 22min
PRs com merge (30d)
2

Descrição

` -fno-strict-aliasing` must be specified for g++, due to the fact that the Py_* macros rely on UB (access through type punned pointers of incompatible types). This issue is not present in python3.

Reference: http://legacy.python.org/dev/peps/pep-3123/

Some of the warnings produced with g++-7.0.1:
```
gcc.compile.c++ bin.v2/libs/python/build/gcc-gnu-7/release/threadapi-pthread/threading-multi/object/class.o
In file included from /usr/include/python2.7/Python.h:80:0,
from ./boost/python/detail/wrap_python.hpp:151,
from ./boost/python/detail/prefix.hpp:13,
from libs/python/src/object/class.cpp:6:
libs/python/src/object/class.cpp: In function ‘PyObject* boost::python::objects::static_data()’:
/usr/include/python2.7/object.h:115:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
^
libs/python/src/object/class.cpp:211:11: note: in expansion of macro ‘Py_TYPE’
Py_TYPE(&static_data_object) = &PyType_Type;
^
libs/python/src/object/class.cpp: In function ‘boost::python::type_handle boost::python::objects::class_metatype()’:
/usr/include/python2.7/object.h:115:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
^
libs/python/src/object/class.cpp:319:11: note: in expansion of macro ‘Py_TYPE’
Py_TYPE(&class_metatype_object) = &PyType_Type;
^
libs/python/src/object/class.cpp: In function ‘boost::python::type_handle boost::python::objects::class_type()’:
/usr/include/python2.7/object.h:115:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
^
libs/python/src/object/class.cpp:473:11: note: in expansion of macro ‘Py_TYPE’
Py_TYPE(&class_type_object) = incref(class_metatype().get());
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.