summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-01-17 17:17:08 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-01-17 17:17:08 (GMT)
commit6b633d4d5159ddd1024ab5b66ff1feeb133184ed (patch)
tree276dbef40cd95462fbf068dc6317dd99d0e650ba
parent50214ad8eab16fae6f98bacf04f7320b08633c0e (diff)
downloadgcc-python-plugin-6b633d4d5159ddd1024ab5b66ff1feeb133184ed.zip
gcc-python-plugin-6b633d4d5159ddd1024ab5b66ff1feeb133184ed.tar.gz
gcc-python-plugin-6b633d4d5159ddd1024ab5b66ff1feeb133184ed.tar.xz
Makefile: add -fno-strict-aliasing to CFLAGS
See https://fedorahosted.org/pipermail/gcc-python-plugin/2012-January/000149.html 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.
-rw-r--r--Makefile2
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