Bug 216718 - multimedia/ffmpeg: clang 4.0 crashes with -O3 -march=native
Summary: multimedia/ffmpeg: clang 4.0 crashes with -O3 -march=native
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-multimedia (Nobody)
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
Reported: 2017-02-02 07:49 UTC by Jan Beich
Modified: 2018-01-10 08:21 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (multimedia)

libavfilter/vf_waveform.c (preprocessed, compressed) (161.96 KB, application/x-xz)
2017-02-02 07:50 UTC, Jan Beich
no flags Details
command line args (for clang 4.0) (7.73 KB, text/plain)
2017-02-02 07:52 UTC, Jan Beich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-02-02 07:49:20 UTC
ffmpeg already passes -O3 by default as part of OPTIMIZED_CFLAGS option, so only CPUTYPE?=native in make.conf was something new.

Assertion failed: (isLoopInvariant(Operands[i], L) && "SCEVAddRecExpr operand is not loop-invariant!"), function getAddRecExpr, file /usr/src/contrib/llvm/lib/Analysis/ScalarEvolution.cpp, line 2963.
cc: error: unable to execute command: Abort trap
cc: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 4.0.0 (branches/release_40 293443) (based on LLVM 4.0.0)
Target: i386-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
Comment 1 Jan Beich freebsd_committer 2017-02-02 07:50:32 UTC
Created attachment 179517 [details]
libavfilter/vf_waveform.c (preprocessed, compressed)
Comment 2 Jan Beich freebsd_committer 2017-02-02 07:52:36 UTC
Created attachment 179518 [details]
command line args (for clang 4.0)

Alternatively, one can do the following:

  $ cd /usr/ports/multimedia/ffmpeg
  $ make configure
  $ cd $(make -V WRKSRC)
  $ cc -m32 -O3 -march=haswell -I. -c libavfilter/vf_waveform.c
Comment 3 Dimitry Andric freebsd_committer 2017-02-02 12:09:18 UTC
Reproduced with llvm trunk r293557.  I submitted an upstream bug report here:
Comment 4 Walter Schwarzenfeld freebsd_triage 2018-01-10 03:25:22 UTC
If I understand this right

it seems done, and could be closed.
Comment 5 Jan Beich freebsd_committer 2018-01-10 08:21:58 UTC
Agree, I can't reproduce the crash on either FreeBSD 11.1 or via devel/llvm40 using either the attached sample or building the port on i386 with CPUTYPE set.