GCC 5.4.0 and also 4.9.0 from ports fail to generate working code for rawtherapee, a C++11 application, and cause it to drop core with a SIGBUS on i386. This is with -O3 -msse2. amd64 is unaffected. Other architectures are untested. GCC 6 and 7-devel are untested. To reproduce, compile ports/heads/graphics/rawtherapee-devel as of r432608 (exactly this version!), add "CFLAGS+=-g" and "STRIP=" to the Makefile and see that it is hit by a SIGBUS in post-install when it tries to check if the program is able to start. DO NOT USE WITH_DEBUG=yes, that will change compiler flags and mask the bug! Debugging this reveals that the generated code crashes when initalizing an auto double[8] = { ... } vector upon entry to the function, when it tries to copy it around with SSE instructions that require 16-byte alignment, but the source address has some 0x...8 address. This affects i386 on 10.3-RELEASE and 11.0-RELEASE (both fully patched). I am reporting this against GCC because this does NOT happen when the code is recompiled with base clang (3.4.0 for FreeBSD 10.3, or 3.8.0 for FreeBSD 11.0.) without changing anything else on the system (in particular, gdk, gtk, ... are NOT touched when switching compilers). Workaround: add -mstackrealign.
I'm sorry we have not been able to get back to this with a change/fix. In our e-mail conversation in January dim@ pointed out that this is a tricky one upstream, cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496 and is unlikely to be addressed, so what you did, Matthias, in graphics/rawtherapee/Makefile is the best I can think of, either.
Wow. The original bug reports are 10 years old. You could've thought this has been fixed long since. The interesting part is that the affected code line per se deals with an array of double values, so that should be happy with 4-byte aligned stacks, but some part of the code employs SSE2 code to initialize the array and that copy-initial-values-code requires 16-byte alignment. Something in the compiler is inconsistent. Either it needs to figure it can't rely on the alignment of the stack - then it cannot use SSE2 instructions, or, if it wants to use SSE2 instructions, it needs to waste 4...12 bytes but make realignment automatic.
Expired port removed.