commit 6b633d4d5159ddd1024ab5b66ff1feeb133184ed
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Tue Jan 17 12:17:08 2012 -0500
Makefile: add -fno-strict-aliasing to CFLAGS
See
https://fedorahosted.org/pipermail/gcc-python-plugin/2012-January/000149....
Python 2's implementation of various macros including Py_INCREF() relies on
undefined C behavior. See PEP 3123:
http://www.python.org/dev/peps/pep-3123/
Thus on modern GCCs it *needs* "-fno-strict-aliasing" in the build flags to
avoid this warning (as an error) from gcc; gcc could potentially
"over-optimize" such code and generate machine code that doesn't do what
we
expect: see also e.g.
http://codespeak.net/pipermail/cython-dev/2008-April/000380.html
http://bugs.python.org/issue969718
The plugin is getting its build flags from $(python-config --cflags), which
*ought* to contain "-fno-strict-aliasing", but this doesn't seem to be
the case
on this user's sysmtem.
Explicilty add "-fno-strict-aliasing" to CFLAGS in our Makefile to make
sure.
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/Makefile b/Makefile
index 9cb244d..3805f1b 100644
--- a/Makefile
+++ b/Makefile
@@ -93,7 +93,7 @@ PYTHON_CONFIG=python-config
PYTHON_CFLAGS=$(shell $(PYTHON_CONFIG) --cflags)
PYTHON_LDFLAGS=$(shell $(PYTHON_CONFIG) --ldflags)
-CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2 -Wall -Werror -g $(PYTHON_CFLAGS)
$(PYTHON_LDFLAGS)
+CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -fno-strict-aliasing -O2 -Wall -Werror -g
$(PYTHON_CFLAGS) $(PYTHON_LDFLAGS)
ifneq "$(PLUGIN_PYTHONPATH)" ""
CFLAGS+= -DPLUGIN_PYTHONPATH='"$(PLUGIN_PYTHONPATH)"'
endif