[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#976795: gdal: Please build with -fno-guess-branch-probability on sh4 to prevent compiler segfault



Source: gdal
Severity: normal
Tags: patch
User: debian-superh@lists.debian.org
Usertags: sh3 sh4
X-Debbugs-Cc: debian-superh@lists.debian.org

Hello!

Due to a bug in gcc, the compiler currently segfaults on sh4 with -O2 unless
-fno-guess-branch-probability is passed as well [1]:

during RTL pass: mach
pcrasterutil.cpp: In function 'void castValuesToBooleanRange(void*, size_t, CSF_CR)':
pcrasterutil.cpp:674:1: internal compiler error: Segmentation fault
  674 | }
      | ^
mmap: Permission denied
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

The attached patch for debian/rules works around this problem by passing the necessary
-fno-guess-branch-probability through DEB_CXXFLAGS_APPEND on sh4 (and sh3):

--- debian/rules.orig   2020-12-06 12:57:44.000000000 +0100
+++ debian/rules        2020-12-08 01:13:56.978960446 +0100
@@ -45,6 +45,11 @@
   WITH_HDF5:=
 endif
 
+# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98189
+ifneq (,$(filter $(DEB_HOST_ARCH),sh3 sh4))
+  export DEB_CXXFLAGS_APPEND=-fno-guess-branch-probability
+endif
+
 ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
   WITH_SSE=yes
   WITH_SSSE3=yes

Could you include that change in the next upload?

Thanks,
Adrian

> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98189

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
--- debian/rules.orig	2020-12-06 12:57:44.000000000 +0100
+++ debian/rules	2020-12-08 01:13:56.978960446 +0100
@@ -45,6 +45,11 @@
   WITH_HDF5:=
 endif
 
+# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98189
+ifneq (,$(filter $(DEB_HOST_ARCH),sh3 sh4))
+  export DEB_CXXFLAGS_APPEND=-fno-guess-branch-probability
+endif
+
 ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
   WITH_SSE=yes
   WITH_SSSE3=yes

Reply to: