[pypy-issue] Issue #2339: CPyExt tests _FORTIFY_SOURCE!=0 and -O0 (pypy/pypy)

Richard Plangger issues-reply at bitbucket.org
Mon Jul 4 04:25:22 EDT 2016

New issue 2339: CPyExt tests _FORTIFY_SOURCE!=0 and -O0

Richard Plangger:

On Fedora (24) and redhat linux many cpyext tests fail, because of the setting described in the title.

_FORTIFY_SOURCE not equal to zero requires an optimization level greater than zero. For some tests -Werror is provided to the compile flag. This fails the test because the compilation cannot succeed.

It seems to be distribution related. The source for not passing the test seems to come from /usr/lib64/python2.7/_sysconfigdata.py where CFLAGS is defined as:

'CFLAGS': '-fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv',

Later in the test [1] we add ```compile_extra = ["-Werror", "-g", "-O0", "-fPIC"]```. -O0 overwrites -O2, which conflicts with _FORTIFY_SOURCE=2.

I have not found an option to remove the effect of -Wp,_FORTIFY_SOURCE=2.

What should we do about this issues?

[1] pypy/module/cpyext/test/test_cpyext.py::test_buffer

Responsible: plan_rich

More information about the pypy-issue mailing list