[cfe-dev] clang segmentation fault in versions >=5.0.2 with `-debug-info-kind=limited`

Kaveh Vaghefi via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 25 10:50:43 PDT 2018


Is there a better way to report this issue?  Maybe I'm the only one using the 16.04 binary packages (not the deb packages) from llvm.org <http://llvm.org/>.


> On Oct 9, 2018, at 2:25 PM, Kaveh Vaghefi <kaveh at vaghefi.org> wrote:
> 
> I definitely install zlib through the zlib1g package (and it's -dev package).
> 
> It's interesting that you mention zlib.  When we moved to Ubuntu 16.04, we couldn't use the clang-4.0.0-16.04 release because it would complain about zlib.  Dropping in the clang-4.0.0-14.04 worked fine.  I wonder if the Ubuntu 16.04 targeted clang releases are working correctly.  Shouldn't they have zlib enabled?
> 
>> On Oct 9, 2018, at 2:11 PM, Reid Kleckner <rnk at google.com <mailto:rnk at google.com>> wrote:
>> 
>> Looks like there's something wrong with the zlib integration. Did you make sure the docker image has zlib? It's also possible that the official release did not have zlib enabled for some reason, that would also cause a crash.
>> 
>> As a workaround, don't request compressed debug info sections.
>> 
>> On Tue, Oct 9, 2018 at 11:21 AM Kaveh Vaghefi via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>> We run clang in a docker container based on Ubuntu 16.04.  In it we download the tar.xz archive for clang, place it in /opt, and symlink it in using `update-alternatives` (here's the line from our Dockerfile)
>> 
>> RUN export CLANG_VERSION=5.0.1 && \
>>     export CLANG_PKG=clang+llvm-$CLANG_VERSION-x86_64-linux-gnu-ubuntu-16.04 && \
>>     wget --progress=bar:force http://llvm.org/releases/$CLANG_VERSION/$CLANG_PKG.tar.xz <http://llvm.org/releases/$CLANG_VERSION/$CLANG_PKG.tar.xz> && \
>>     tar xvfJ $CLANG_PKG.tar.xz -C /opt && \
>>     chmod -R 755 /opt/$CLANG_PKG && \
>>     # make symlinks to abstract compiler version
>>     update-alternatives --install /usr/bin/clang clang /opt/$CLANG_PKG/bin/clang 100 \
>>         --slave /usr/bin/clang++ clang++ /opt/$CLANG_PKG/bin/clang++ \
>>         --slave /usr/bin/llvm-symbolizer llvm-symbolizer /opt/$CLANG_PKG/bin/llvm-symbolizer \
>>         --slave /usr/bin/llvm-profdata llvm-profdata /opt/$CLANG_PKG/bin/llvm-profdata\
>>         --slave /usr/bin/llvm-ar llvm-ar /opt/$CLANG_PKG/bin/llvm-ar \
>>         --slave /usr/bin/lld lld /opt/$CLANG_PKG/bin/lld \
>>         --slave /usr/bin/llvm-nm llvm-nm /opt/$CLANG_PKG/bin/llvm-nm \
>>         --slave /usr/bin/llvm-objdump llvm-objdump /opt/$CLANG_PKG/bin/llvm-objdump \
>>         --slave /usr/bin/clang-format clang-format /opt/$CLANG_PKG/bin/clang-format \
>>         --slave /usr/bin/llvm-ranlib llvm-ranlib /opt/$CLANG_PKG/bin/llvm-ranlib \
>>         --slave /lib/libc++.so libc++.so /opt/$CLANG_PKG/lib/libc++.so \
>>         --slave /lib/libc++.so.1 libc++.so.1 /opt/$CLANG_PKG/lib/libc++.so.1 \
>>         --slave /lib/libc++.so.1.0 libc++.so.1.0 /opt/$CLANG_PKG/lib/libc++.so.1.0 \
>>         --slave /lib/libc++abi.so libc++abi.so /opt/$CLANG_PKG/lib/libc++abi.so \
>>         --slave /lib/libc++abi.so.1 libc++abi.so.1 /opt/$CLANG_PKG/lib/libc++abi.so.1 \
>>         --slave /lib/libc++abi.so.1.0 libc++abi.so.1.0 /opt/$CLANG_PKG/lib/libc++abi.so.1.0 \
>>         --slave /lib/libomp.so libomp.so /opt/$CLANG_PKG/lib/libomp.so
>> 
>> I'm finding that if I use any version after 5.0.1, clang exhibits a segmentation fault with the `-g` option passed in.  If I remove the `-debug-info-kind=limited` command on the invocation below, the segmentation fault does not happen.  I believe this is a bug that needs to be fixed, but I'd appreciate the insight of someone more knowledgable with clang.
>> 
>> $ /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0 \
>> > -cc1 \
>> > -triple x86_64-unknown-linux-gnu \
>> > -emit-obj \
>> > --compress-debug-sections \
>> > -disable-free \
>> > -disable-llvm-verifier \
>> > -discard-value-names \
>> > -main-file-name buildinfo_query.cc <http://buildinfo_query.cc/> \
>> > -mrelocation-model static \
>> > -mthread-model posix \
>> > -mdisable-fp-elim \
>> > -fmath-errno \
>> > -masm-verbose \
>> > -mconstructor-aliases \
>> > -munwind-tables \
>> > -fuse-init-array \
>> > -target-cpu x86-64 \
>> > -momit-leaf-frame-pointer \
>> > -dwarf-column-info \
>> > -debug-info-kind=limited \
>> > -dwarf-version=4 \
>> > -debugger-tuning=gdb \
>> > -coverage-notes-file /proc/self/cwd/bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.gcno \
>> > -resource-dir /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/lib/clang/5.0.2 \
>> > -dependency-file bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.d \
>> > -MT bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.o \
>> > -sys-header-deps \
>> > -iquote . \
>> > -iquote bazel-out/k8-py3-opt/genfiles \
>> > -iquote external/bazel_tools \
>> > -iquote bazel-out/k8-py3-opt/genfiles/external/bazel_tools \
>> > -isystem external/bazel_tools/tools/cpp/gcc3 \
>> > -D NDEBUG \
>> > -internal-isystem /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1 \
>> > -internal-isystem /usr/local/include \
>> > -internal-isystem /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/lib/clang/5.0.2/include \
>> > -internal-externc-isystem /usr/include/x86_64-linux-gnu \
>> > -internal-externc-isystem /usr/include \
>> > -O3 \
>> > -Wthread-safety \
>> > -Wno-unknown-pragmas \
>> > -Wno-inconsistent-missing-override \
>> > -Wno-deprecated-register \
>> > -Werror \
>> > -Wno-sign-compare \
>> > -Wno-invalid-partial-specialization \
>> > -std=c++1z \
>> > -fdeprecated-macro \
>> > -fdebug-compilation-dir /proc/self/cwd \
>> > -ferror-limit 19 \
>> > -fmessage-length 0 \
>> > -fopenmp \
>> > -fobjc-runtime=gcc \
>> > -fcxx-exceptions \
>> > -fexceptions \
>> > -fdiagnostics-show-option \
>> > -vectorize-loops \
>> > -vectorize-slp \
>> > -o bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.o \
>> > -x c++ devtools/buildinfo_query.cc <http://buildinfo_query.cc/>
>> #0 0x0000000001a63ae4 PrintStackTraceSignalHandler(void*) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1a63ae4)
>> #1 0x0000000001a63dc6 SignalHandler(int) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1a63dc6)
>> #2 0x00007fa3729bd390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
>> #3 0x000000000181e2a4 llvm::Error llvm::handleErrors<llvm::consumeError(llvm::Error)::{lambda(llvm::ErrorInfoBase const&)#1}>(llvm::Error, llvm::consumeError(llvm::Error)::{lambda(llvm::ErrorInfoBase const&)#1}&&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x181e2a4)
>> #4 0x0000000001819b37 (anonymous namespace)::ELFObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1819b37)
>> #5 0x000000000182a8bb llvm::MCAssembler::Finish() (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x182a8bb)
>> #6 0x000000000207ef9c llvm::AsmPrinter::doFinalization(llvm::Module&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x207ef9c)
>> #7 0x000000000169b163 llvm::FPPassManager::doFinalization(llvm::Module&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x169b163)
>> #8 0x000000000169b561 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x169b561)
>> #9 0x0000000001ba4dd2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1ba4dd2)
>> #10 0x0000000002298f0d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x2298f0d)
>> #11 0x00000000024c5636 clang::ParseAST(clang::Sema&, bool, bool) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x24c5636)
>> #12 0x0000000001f2cf0f clang::FrontendAction::Execute() (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1f2cf0f)
>> #13 0x0000000001ede2b8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1ede2b8)
>> #14 0x0000000001fa94ad clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x1fa94ad)
>> #15 0x00000000008afd51 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x8afd51)
>> #16 0x00000000008ae5e6 main (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x8ae5e6)
>> #17 0x00007fa371955830 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20830)
>> #18 0x00000000008ab999 _start (/opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0+0x8ab999)
>> Stack dump:
>> 0.      Program arguments: /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang-5.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --compress-debug-sections -disable-free -disable-llvm-verifier -discard-value-names -main-file-name buildinfo_query.cc <http://buildinfo_query.cc/> -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /proc/self/cwd/bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.gcno -resource-dir /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/lib/clang/5.0.2 -dependency-file bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.d -MT bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.o -sys-header-deps -iquote . -iquote bazel-out/k8-py3-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/k8-py3-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -D NDEBUG -internal-isystem /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/../include/c++/v1 -internal-isystem /usr/local/include -internal-isystem /opt/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/lib/clang/5.0.2/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -O3 -Wthread-safety -Wno-unknown-pragmas -Wno-inconsistent-missing-override -Wno-deprecated-register -Werror -Wno-sign-compare -Wno-invalid-partial-specialization -std=c++1z -fdeprecated-macro -fdebug-compilation-dir /proc/self/cwd -ferror-limit 19 -fmessage-length 0 -fopenmp -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o bazel-out/k8-py3-opt/bin/devtools/_objs/buildinfo_query/devtools/buildinfo_query.o -x c++ devtools/buildinfo_query.cc <http://buildinfo_query.cc/>
>> 1.      <eof> parser at end of file
>> 2.      Code generation
>> Segmentation fault (core dumped)
>> 
>> 
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181025/cda74acb/attachment.html>


More information about the cfe-dev mailing list