Bug#722115: 722115 patches

2013-09-16 Thread Rebecca N. Palmer
Following private discussion, this version of the patch enables 
-fno-strict-aliasing selectively by architecture, to avoid possibly 
slowing down those that don't need it.


(I included sparc, which currently works, because the big-endian code is 
undefined as opposed to guaranteed wrong, and hence might break later 
from an apparently unrelated change.)


If this is what the problem is, it is still present in 2.12rc, and the 
same fix should work there.
diff -up debian/rules_orig debian/rules
--- debian/rules_orig	2013-09-12 23:01:10.938897982 +0100
+++ debian/rules	2013-09-16 23:55:27.712339252 +0100
@@ -6,8 +6,14 @@
 
 #http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake
 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
+ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 i386 mipsel ia64 armel armhf arm64))
 CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
 CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
+else
+#required on big-endian architectures, see bug 722115
+CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -fno-strict-aliasing
+CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS) -fno-strict-aliasing
+endif
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
 CMAKE_FLAGS = \


Bug#722115: 722115 patches

2013-09-12 Thread Rebecca N. Palmer
The test_cppbind issue appears to be caused by using a plain char 
(unsigned on affected platforms) to hold -1: it can be triggered on 
amd64 by the -funsigned-char compiler flag, and is there fixed by the 
attached patch.


I can't reproduce the binobj bug, but enabling -fno-strict-aliasing may 
fix it, as it uses a lot of casts that are undefined without it (mostly 
for endianness reversal, which fits with the error only appearing on 
big-endian machines).
diff -up flightgear_source/simgear-2.10.0/simgear/nasal/data.h_orig flightgear_source/simgear-2.10.0/simgear/nasal/data.h
--- flightgear_source/simgear-2.10.0/simgear/nasal/data.h_orig	2013-09-09 22:40:33.107742921 +0100
+++ flightgear_source/simgear-2.10.0/simgear/nasal/data.h	2013-09-09 22:06:43.595678127 +0100
@@ -96,7 +96,7 @@ struct naObj {
 #define MAX_STR_EMBLEN 15
 struct naStr {
 GC_HEADER;
-char emblen; /* [0-15], or -1 to indicate not embedded */
+signed char emblen; /* [0-15], or -1 to indicate not embedded */
 unsigned int hashcode;
 union {
 unsigned char buf[16];

diff -up debian/rules_orig debian/rules
--- debian/rules_orig	2013-09-12 23:01:10.938897982 +0100
+++ debian/rules	2013-09-12 23:00:56.358898413 +0100
@@ -6,8 +6,8 @@
 
 #http://wiki.debian.org/Hardening#Notes_for_packages_using_CMake
 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
-CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
-CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
+CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -fno-strict-aliasing
+CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS) -fno-strict-aliasing
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
 CMAKE_FLAGS = \