On Tue, 18 Aug 2020 08:39:30 +0200
Charlene Wendling <[email protected]> wrote:

> In the current macppc bulk, graphics/babl and emulators/mednafen are
> failing similarly with: 
> 
> > 1.      <eof> parser at end of file
> > 2.      Code generation
> > 3.      Running pass 'Function Pass Manager' on module
> > '../babl-0.1.80/babl/base/model-ycbcr.c'.
> > 4.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection'
> > on function '@rgba_to_ycbcr'
> > cc: error: clang frontend command failed  due to signal (use -v to
> > see invocation)

babl and mednafen are passing -fno-unsafe-math-optimizations to clang;
this flag implies -ftrapping-math, which seems to be broken in the
PowerPC backend.  Another name for -ftrapping-math is
-ffp-exception-behavior=strict

mednafen is also broken on powerpc64 (but the error message is
different: "Cannot select: ...: i64 = fp_to_sint ...");
babl has a powerpc64 snap package.

One may run the crash reproducers on any clang with the PowerPC
backend, like base-clang on powerpc64, or ports-clang on amd64 (after
you edit the .sh to use ports-clang); but mednafen's reproducer from
macppc doesn't crash on powerpc64 nor amd64.  By not crashing, it
emits a 32-bit PowerPC elf.

I reproduced a crash on amd64 by taking medafen's reproducer from
powerpc64.  I edited the reproducer to remove most cc1 flags.
Removing -ffp-exception-behavior=strict prevents the crash.  So far,
I have used clang 10.0.1.  If I use clang-12 (from upstream's git
master), then no crash happens; clang-12 warns,

warning: overriding currently unsupported use of floating point exceptions on th
is target [-Wunsupported-floating-point-opt]

Upstream might have disabled -ftrapping-math for PowerPC to work
around the bug.  To be more sure, I need to try building babl or
mednafen on macppc without -fno-unsafe-math-optimizations.  If that
works, I will want to backport something from upstream.

--George

Reply via email to