Bug 222280

Summary: www/firefox: 57.0 crashes clang during build
Product: Base System Reporter: Jan Beich <jbeich>
Component: binAssignee: Dimitry Andric <dim>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: davide, dim, emaste
Priority: --- Keywords: needs-qa
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1399412
Attachments:
Description Flags
mfbt/Compression.cpp (preprocessed, compressed)
none
command line args (for clang 5.0) none

Description Jan Beich freebsd_committer freebsd_triage 2017-09-13 10:36:00 UTC
/usr/bin/c++ -std=gnu++11 -o Compression.o -c -Iobj-x86_64-unknown-freebsd12.0/dist/system_wrappers -include config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -DIMPL_MFBT -Imfbt -Iobj-x86_64-unknown-freebsd12.0/mfbt  -Iobj-x86_64-unknown-freebsd12.0/dist/include  -Iobj-x86_64-unknown-freebsd12.0/dist/include/nspr -Iobj-x86_64-unknown-freebsd12.0/dist/include/nss       -fPIC  -DMOZILLA_CLIENT -include obj-x86_64-unknown-freebsd12.0/mozilla-config.h -MD -MP -MF .deps/Compression.o.pp -Qunused-arguments    -I/usr/local/include -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wno-gnu-zero-variadic-macro-arguments -Wformat-security -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -pipe  -O -fno-omit-frame-pointer   -Wno-error=shadow  -Wno-unused-function mfbt/Compression.cpp
Assertion failed: (!Old || Old->getCachedLinkage() == D->getCachedLinkage()), function getLVForDecl, file /usr/src/contrib/llvm/tools/clang/lib/AST/Decl.cpp, line 1434.
c++: error: unable to execute command: Abort trap
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 5.0.0 (tags/RELEASE_500/final 312559) (based on LLVM 5.0.0svn)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin

Regressed by: https://hg.mozilla.org/mozilla-central/rev/9a4077eda5d8
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-09-13 10:36:56 UTC
Created attachment 186324 [details]
mfbt/Compression.cpp (preprocessed, compressed)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2017-09-13 10:37:46 UTC
Created attachment 186325 [details]
command line args (for clang 5.0)
Comment 3 Jan Beich freebsd_committer freebsd_triage 2017-09-13 10:41:45 UTC
Reproducible on Clang 4.0 and 3.9.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2017-09-13 16:34:28 UTC
This can be reduced to just:

// clang -cc1 -triple x86_64 -S bug222280.cpp
namespace {
  extern "C" union LZ4_stream_u *LZ4_createStream();
  LZ4_stream_u *LZ4_createStream();
}

It's apparently a long-standing problem upstream, as there are multiple bugs about it, but no conclusive fix:

https://bugs.llvm.org/show_bug.cgi?id=18964
https://bugs.llvm.org/show_bug.cgi?id=19995
https://bugs.llvm.org/show_bug.cgi?id=21854
https://bugs.llvm.org/show_bug.cgi?id=23090
https://bugs.llvm.org/show_bug.cgi?id=33503

I'll see if I can get some movement on this upstream, and close off a bunch of duplicates.