Re: GCC i386 stack misalignment: [package - head-i386-default][graphics/rawtherapee-devel] Failed for rawtherapee-devel-5.0 in stage

2017-01-29 Thread Dimitry Andric
On 29 Jan 2017, at 19:35, Matthias Andree  wrote:
> whenever I've traced one of the attached SIGBUS issues on gcc-compiled
> i386 code with SSE2, I found that it was using unaligned 128-bit =
> 16-byte wide SSE2 access which also needs 16-byte aligned data
> (including stacks).

See these very old bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496

PR 40838 is 8 years old and still has status NEW, PR38496 has WONTFIX.

E.g. don't count on this getting fixed upstream.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


GCC i386 stack misalignment: [package - head-i386-default][graphics/rawtherapee-devel] Failed for rawtherapee-devel-5.0 in stage

2017-01-29 Thread Matthias Andree
Greetings,

whenever I've traced one of the attached SIGBUS issues on gcc-compiled
i386 code with SSE2, I found that it was using unaligned 128-bit =
16-byte wide SSE2 access which also needs 16-byte aligned data
(including stacks).

For rawtherapee in particular, the crash happens in one of the C++
constructors that don't do anything beyond initializing an auto
double[8] = { ... } vector and then create STL containers from the vector.

Please see BZ#216563 here for more details:


While I don't think there's anything special about the attached case, it
does involve callbacks through Gtkmm and all its requisites, but never
shows up when the code is compiled with Clang.

Please investigate why GCC-compiled -msse2 code on i386 is prone to
insufficiently aligned stacks. I can't do it, am not knowledgable about
compiler innards and only see the high-level difference "gcc fucks up,
clang compiles usable code".

WRT rawtherapee, I'm fed up with the compiler generating nonworking code
and force -mstackrealign on i386, and I've pulled the plug on any
non-amd64 stuff on FreeBSD12+ because I don't have time to sort this
mess out.

(The interesting question is why 12-CURRENT i386 uses GCC, rather than
clang. Some of the Uses/compiler.mk logic must be hosed there, assuming
that the 12-CURRENT base compiler can't fully do c++11. If it really
can't do that, we should make it.)
--- Begin Message ---
You are receiving this mail as a port that you maintain
is failing to build on the FreeBSD package build server.
Please investigate the failure and submit a PR to fix
build.

Maintainer: mand...@freebsd.org
Last committer: mand...@freebsd.org
Ident:  $FreeBSD: head/graphics/rawtherapee-devel/Makefile 432608 
2017-01-28 00:49:11Z mandree $
Log URL:
http://beefy11.nyi.freebsd.org/data/head-i386-default/p432608_s312909/logs/rawtherapee-devel-5.0.log
Build URL:  
http://beefy11.nyi.freebsd.org/build.html?mastername=head-i386-default=p432608_s312909
Log:

>> Building graphics/rawtherapee-devel
build started at Sun Jan 29 16:27:28 UTC 2017
port directory: /usr/ports/graphics/rawtherapee-devel
building for: FreeBSD head-i386-default-job-05 12.0-CURRENT FreeBSD 
12.0-CURRENT r312909 i386
maintained by: mand...@freebsd.org
Makefile ident:  $FreeBSD: head/graphics/rawtherapee-devel/Makefile 432608 
2017-01-28 00:49:11Z mandree $
Poudriere version: 3.1.14
Host OSVERSION: 1200018
Jail OSVERSION: 1200020
Job Id: 05




!!! Jail is newer than host. (Jail: 1200020, Host: 1200018) !!!
!!! This is not supported. !!!
!!! Host kernel must be same or newer than jail. !!!
!!! Expect build failures. !!!



---Begin Environment---
SHELL=/bin/csh
UNAME_p=i386
UNAME_m=i386
UNAME_v=FreeBSD 12.0-CURRENT r312909
UNAME_r=12.0-CURRENT
BLOCKSIZE=K
MAIL=/var/mail/root
STATUS=1
OPSYS=FreeBSD
ARCH=i386
SAVED_TERM=
MASTERMNT=/usr/local/poudriere/data/.m/head-i386-default/ref
UID=0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
_JAVA_VERSION_LIST_REGEXP=1.6\|1.7\|1.8\|1.6+\|1.7+\|1.8+
POUDRIERE_BUILD_TYPE=bulk
PKGNAME=rawtherapee-devel-5.0
OSREL=12.0
_OSRELEASE=12.0-CURRENT
PYTHONBASE=/usr/local
OLDPWD=/
_SMP_CPUS=24
PWD=/usr/local/poudriere/data/.m/head-i386-default/ref/.p/pool
MASTERNAME=head-i386-default
SCRIPTPREFIX=/usr/local/share/poudriere
_JAVA_VENDOR_LIST_REGEXP=openjdk\|oracle\|sun
USER=root
HOME=/root
POUDRIERE_VERSION=3.1.14
SCRIPTPATH=/usr/local/share/poudriere/bulk.sh
CONFIGURE_MAX_CMD_LEN=262144
LIBEXECPREFIX=/usr/local/libexec/poudriere
LOCALBASE=/usr/local
PACKAGE_BUILDING=yes
_JAVA_OS_LIST_REGEXP=native\|linux
OSVERSION=1200020
---End Environment---

---Begin OPTIONS List---
===> The following configuration options are available for 
rawtherapee-devel-5.0:
 NATIVE=off: Use -march=native for compilation (do not use for generic 
packages!)
 OPENMP=on: Enable multicore processing using OpenMP (amd64)
 OPTIMIZED_CFLAGS=on: Use extra compiler optimizations (requires SSE2 
support)
===> Use 'make config' to modify these settings
---End OPTIONS List---

--CONFIGURE_ARGS--

--End CONFIGURE_ARGS--

--CONFIGURE_ENV--
CFLAGS="-O2 -pipe  -I/usr/local/include -fPIC -D_GLIBCXX_USE_C99 
-Wno-deprecated-declarations -Wno-unused-result -O3 -funroll-loops -msse2 
-fexpensive-optimizations -fstack-protector -Wl,-rpath=/usr/local/lib/gcc5 
-isystem /usr/local/include -fno-strict-aliasing" PKG_CONFIG=pkgconf 
XDG_DATA_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
XDG_CONFIG_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work TMPDIR="/tmp" 
SHELL=/bin/sh CONFIG_SHELL=/bin/sh CMAKE_PREFIX_PATH="/usr/local"
--End CONFIGURE_ENV--

--MAKE_ENV--
XDG_DATA_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
XDG_CONFIG_HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work  
HOME=/wrkdirs/usr/ports/graphics/rawtherapee-devel/work TMPDIR="/tmp" 
NO_PIE=yes