Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Clang segfaulted #1223

Closed
qwandor-google opened this issue Apr 3, 2020 · 1 comment
Closed

[BUG] Clang segfaulted #1223

qwandor-google opened this issue Apr 3, 2020 · 1 comment
Assignees
Labels

Comments

@qwandor-google
Copy link

Description

Clang segfaulted and told me to file a bug here.

Stack dump:
0. Program arguments: /usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9 -cc1 -triple aarch64-none-unknown-eabi -emit-llvm-bc -flto -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name memory_sharing.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -ffreestanding -fuse-init-array -target-cpu cortex-a57 -target-feature +neon -target-feature +crc -target-feature +crypto -target-feature +fp-armv8 -target-feature +sha2 -target-feature +aes -target-feature +strict-align -target-abi aapcs -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /usr/local/google/home/qwandor/hafnium/hafnium/out/reference/aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.memory_sharing.gcno -nostdsysteminc -nobuiltininc -resource-dir /usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/lib64/clang/9.0.3 -dependency-file aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.memory_sharing.o.d -MT aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.memory_sharing.o -isystem /usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/lib64/clang/9.0.3/include -isystem /usr/local/google/home/qwandor/hafnium/hafnium/inc/system -D VM_TOOLCHAIN=1 -D GIC_VERSION=3 -D GICD_BASE=0x2f000000 -D GICR_BASE=0x2f100000 -D HEAP_PAGES=0 -D MAX_CPUS=8 -D MAX_VMS=0 -D LOG_LEVEL=LOG_LEVEL_INFO -I ../../inc -I ../../inc/vmapi -I ../../src/arch/aarch64/inc -I aem_v8a_fvp_vm_clang/gen/offset_size_header -I ../../test/vmapi/primary_with_secondaries/inc -I ../../src/arch/aarch64 -I ../../test/inc -O2 -Wall -Wpedantic -Werror -std=c11 -fdebug-compilation-dir /usr/local/google/home/qwandor/hafnium/hafnium/out/reference -ferror-limit 19 -fmessage-length 0 -stack-protector 3 -fno-builtin -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.memory_sharing.o -x c ../../test/vmapi/primary_with_secondaries/memory_sharing.c -faddrsig

  1. ../../test/vmapi/primary_with_secondaries/memory_sharing.c:153:31: current parser token ')'
  2. ../../test/vmapi/primary_with_secondaries/memory_sharing.c:139:1: parsing function body 'check_cannot_donate_memory'
  3. ../../test/vmapi/primary_with_secondaries/memory_sharing.c:139:1: in compound statement ('{}')
  4. ../../test/vmapi/primary_with_secondaries/memory_sharing.c:143:40: in compound statement ('{}')
    #0 0x00000000025a7a05 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x25a7a05)
    Clang3.8 cross-compile linker issues libc (undefined references) #1 0x00000000025a63ce llvm::sys::RunSignalHandlers() (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x25a63ce)
    ndk-gdb fails on OS X #2 0x00000000025a7eb8 (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x25a7eb8)
    ndk-gdb.py fails #3 0x00007f5caf948520 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13520)
    ndk-gdb.py --project option treats ~/... as a relative path #4 0x0000000003a0c511 clang::Expr::isDefaultArgument() const (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3a0c511)
    Unknown argument -mandroid #5 0x000000000368db2e (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x368db2e)
    asan_device_setup error bricks phone #6 0x0000000003681494 (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3681494)
    no renderscript headers/library in r11 #7 0x000000000367eea7 (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x367eea7)
    clang __thread caused linker error #8 0x000000000367a36b (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x367a36b)
    Clang not compiled with OpenMP support #9 0x0000000003669c6f clang::Sema::CorrectDelayedTyposInExpr(clang::Expr*, clang::VarDecl*, llvm::function_ref<clang::ActionResult<clang::Expr*, true> (clang::Expr*)>) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3669c6f)
    error: undefined reference to '__atomic_exchange_4' #10 0x000000000361cf0b clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*, clang::SourceLocation, llvm::ArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*, bool, clang::CallExpr::ADLCallKind) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x361cf0b)
    Support for _POSIX_THREAD_SAFE_FUNCTIONS #11 0x000000000360ee53 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRefclang::Expr*, clang::SourceLocation, clang::Expr*, bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x360ee53)
    ld.bfd 2.25.51 packaged with NDK r11 produces unsupported R_ARM_COPY relocation #12 0x00000000033d293d clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33d293d)
    No support for debugging library projects #13 0x00000000033d4160 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33d4160)
    Using precompiled header causes compilation error of tagged files #14 0x00000000033d263a clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33d263a)
    Compile error when including <complex> #15 0x00000000033d18fb clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33d18fb)
    Compile error when using clang and precompiled headers #16 0x00000000033d1699 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33d1699)
    r11: libc++_static.a contains symbols in libc.a (causes multiple definition error) #17 0x00000000033a736e clang::Parser::ParseExprStatement() (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a736e)
    Extraction instructions are wrong #18 0x00000000033a6983 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6983)
    r11: some commands removed from NDK_ROOT #19 0x00000000033a6790 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6790)
    ndk-stack does not work with 64-bit binaries #20 0x00000000033ab323 clang::Parser::ParseCompoundStatementBody(bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33ab323)
    Clang produces much larger binaries than GCC #21 0x00000000033aaa6a clang::Parser::ParseCompoundStatement(bool, unsigned int) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33aaa6a)
    NDK r11 for Linux size / hash mismatch #22 0x00000000033a6a08 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6a08)
    NDK r11 undefined reference #23 0x00000000033a6790 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6790)
    ndk-stack file is missing #24 0x00000000033a66c0 clang::Parser::ParseStatement(clang::SourceLocation*, bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a66c0)
    NDK 2.0.0 fails to installs as part of Android Studio 1.5.1 (Download finished with wrong size) #25 0x00000000033a90d4 clang::Parser::ParseForStatement(clang::SourceLocation*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a90d4)
    Why did you deprecate GCC? #26 0x00000000033a6ab2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6ab2)
    Why is native code compiled with -fno-strict-aliasing? #27 0x00000000033a6790 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33a6790)
    Unable to use Clang as part of Android Studio #28 0x00000000033ab323 clang::Parser::ParseCompoundStatementBody(bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33ab323)
    r11b: ndk-which dosen't work #29 0x00000000033ac049 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33ac049)
    Missing 64 bit FILE stream functions #30 0x00000000033963df clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33963df)
    armeabi libatomic.a uses ifuncs #31 0x00000000033c3eb9 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x33c3eb9)
    clang doesn't make the difference between UL & ULL sufixes #32 0x0000000003395dc9 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3395dc9)
    Cannot find module with tag 'cpufeatures' in import path #33 0x0000000003395acd clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3395acd)
    clang doesn't export explicit specializations function templates #34 0x0000000003394ad6 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3394ad6)
    Arm gdb missing #35 0x0000000003394394 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3394394)
    ndk r11b __cxxabi_config still missing #36 0x0000000003390f92 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x3390f92)
    Issues with autoconf & libtool #37 0x0000000002aad345 clang::FrontendAction::Execute() (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x2aad345)
    Clang toolchains are still named *-clang3.6 #38 0x0000000002a50818 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x2a50818)
    libc++_shared (both hard float abi variants) fail to load properly #39 0x0000000002b1ed15 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x2b1ed15)
    No way of detecting the exact version of the NDK programmatically #40 0x00000000019c09a4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x19c09a4)
    make-standalone-toolchain.sh doesn't work with Cygwin #41 0x00000000019bcfd1 main (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x19bcfd1)
    ndk r11b libc.so files don't contain all the symbols that r10e libc.so files did #42 0x00007f5caf536bbb __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26bbb)
    r11 clang: undefined reference to 'dladdr' #43 0x00000000019bc029 _start (/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin/clang-9+0x19bc029)
    clang-9: error: unable to execute command: Segmentation fault
    clang-9: error: clang frontend command failed due to signal (use -v to see invocation)
    Android (5484270 based on r353983c) clang version 9.0.3 (https://android.googlesource.com/toolchain/clang 745b335211bb9eadfa6aa6301f84715cee4b37c5) (https://android.googlesource.com/toolchain/llvm 60cf23e54e46c807513f7a36d0a7b777920b5881) (based on LLVM 9.0.3svn)
    Target: aarch64-none-unknown-eabi
    Thread model: posix
    InstalledDir: /usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/bin
    clang-9: note: diagnostic msg: PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
    clang-9: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/memory_sharing-7baa26.c
clang-9: note: diagnostic msg: /tmp/memory_sharing-7baa26.sh
clang-9: note: diagnostic msg:


[32/859] CC aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.perfmon.o
FAILED: aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.perfmon.o
clang -MMD -MF aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.perfmon.o.d -DVM_TOOLCHAIN=1 -DGIC_VERSION=3 -DGICD_BASE=0x2f000000 -DGICR_BASE=0x2f100000 -DHEAP_PAGES=0 -DMAX_CPUS=8 -DMAX_VMS=0 -DLOG_LEVEL=LOG_LEVEL_INFO -I../../inc -I../../inc/vmapi -I../../src/arch/aarch64/inc -Iaem_v8a_fvp_vm_clang/gen/offset_size_header -I../../test/vmapi/primary_with_secondaries/inc -I../../src/arch/aarch64 -I../../test/inc -ffunction-sections -fdata-sections -flto -fno-builtin -ffreestanding -fpic -mcpu=cortex-a57+fp -mstrict-align -target aarch64-none-eabi -fcolor-diagnostics -nostdinc -isystem/usr/local/google/home/qwandor/hafnium/hafnium/prebuilts/linux-x64/clang/lib64/clang/9.0.3/include -isystem/usr/local/google/home/qwandor/hafnium/hafnium/inc/system -g -Wall -O2 -Wpedantic -Werror -fstack-protector-all -std=c11 -c ../../test/vmapi/primary_with_secondaries/perfmon.c -o aem_v8a_fvp_vm_clang/obj/test/vmapi/primary_with_secondaries/obj/test/vmapi/primary_with_secondaries/primary_with_secondaries_test_vm.elf.perfmon.o

Environment Details

Preprocessed source and run script:
memory_sharing-7baa26.zip

@pirama-arumuga-nainar
Copy link
Collaborator

This is fixed in r21, in particular, https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/heads/master/clang-r365631c1/ in r21b.

With the r21b clang, I get the errors (unlike the crash, which is a segfault when Clang attempts to suggest fixes/corrections). I recall seeing a similar crash earlier but I don't think we need to track that down since this is fixed in the latest NDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants