On Mon, Aug 21, 2017 at 10:02 AM, Benjamin Barenblat <bba...@mit.edu> wrote:
> I did an arm64 build with -O1 (i.e., I put
>
>     export DEB_CFLAGS_MAINT_APPEND := -O1
>
> in debian/rules), and everything worked fine […]. I’m doing a mips64el
> build with -O1 right now to see if that fixes the issue on mipsel64. If
> it does, I’ll start binary-searching the individual -O2 optimization
> flags to see exactly what’s triggering this.

-O1 built fine on mipsel64. One binary search later, and I’ve determined
that the problematic optimization on both platforms is
-fcode-hoisting. This is a new optimization pass in GCC 7 which “tries
to move the evaluation of expressions executed on all paths to the
function exit as early as possible.”¹

While this doesn’t eliminate either a bug in MLton or in GCC, it does
provide a workaround for this package, namely

    export DEB_CFLAGS_MAINT_APPEND := -fno-code-hoisting

However, the correct solution is still to fix whatever compiler is
miscompiling here. I’m going to do a bit more digging to see if I can
figure out whether it’s MLton or GCC.


¹https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Optimize-Options.html#index-fcode-hoisting

Reply via email to