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

[SR-10090] llvm assertion failed when importing C code #52492

Closed
krzyzanowskim opened this issue Mar 12, 2019 · 7 comments
Closed

[SR-10090] llvm assertion failed when importing C code #52492

krzyzanowskim opened this issue Mar 12, 2019 · 7 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@krzyzanowskim
Copy link
Contributor

Previous ID SR-10090
Radar None
Original Reporter @krzyzanowskim
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

swift-DEVELOPMENT-SNAPSHOT-2019-03-04-a.xctoolchain

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 850c2409db336d1ffaa73de700f00819

Issue Description:

Please find compilation error and attached files:

Assertion failed: (FieldInfo.count(FD) && "Invalid field for record!"), function getLLVMFieldNo, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/tools/clang/lib/CodeGen/CGRecordLayout.h, line 187.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-03-04-a.xctoolchain/usr/bin/clang-7 -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -main-file-name render.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -faligned-alloc-unavailable -target-sdk-version=10.14 -target-cpu core2 -dwarf-column-info -dwarf-ext-refs -fmodule-format=obj -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -ggnu-pubnames -target-linker-version 450.3 -fprofile-instrument=clang -fcoverage-mapping -coverage-notes-file /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Objects-normal/x86_64/render.gcno -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-03-04-a.xctoolchain/usr/lib/clang/7.0.0 -index-store-path /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Index/DataStore -dependency-file /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Objects-normal/x86_64/render.d -MT dependencies -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -iquote /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Down-generated-files.hmap -ivfsoverlay /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/all-product-headers.yaml -iquote /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Down-project-headers.hmap -D DEBUG=1 -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Down-own-target-headers.hmap -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Down-all-non-framework-target-headers.hmap -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Products/Debug/include -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/DerivedSources-normal/x86_64 -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/DerivedSources/x86_64 -I /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/DerivedSources -F/Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Products/Debug -O0 -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wdeprecated-declarations -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -w -std=gnu99 -fdebug-compilation-dir /Users/marcinkrzyzanowski/Devel/Down -ferror-limit 19 -fmacro-backtrace-limit 0 -fmessage-length 0 -stack-protector 1 -fblocks -fencode-extended-block-signature -fmodules -fimplicit-module-maps -fmodules-cache-path=/Users/marcinkrzyzanowski/Devel/Down/DerivedData/ModuleCache.noindex -fmodule-name=Down -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-timestamp=1552421177331407683 -fmodules-validate-once-per-build-session -fmodules-validate-system-headers -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.11.0 -fpascal-strings -fmax-type-align=16 -fno-common -fdiagnostics-show-option -fdiagnostics-show-note-include-stack -fasm-blocks -serialize-diagnostic-file /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Objects-normal/x86_64/render.dia -o /Users/marcinkrzyzanowski/Devel/Down/DerivedData/Down/Build/Intermediates.noindex/Down.build/Debug/Down.build/Objects-normal/x86_64/render.o -x c /Users/marcinkrzyzanowski/Devel/Down/Source/cmark/render.c 
1.  <eof> parser at end of file
2.  Per-file LLVM IR generation
3.  /Users/marcinkrzyzanowski/Devel/Down/Source/cmark/node.h:84:32: Generating code for declaration 'cmark_node_mem'
0  clang-7                  0x000000010a81eef5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-7                  0x000000010a81e195 llvm::sys::RunSignalHandlers() + 85
2  clang-7                  0x000000010a81f4e8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff616edb3d _sigtramp + 29
4  clang-7                  0x000000010d56b108 llvm::DenseMapInfo<llvm::codeview::GloballyHashedType>::Tombstone + 126776
5  libsystem_c.dylib        0x00007fff615ab1c9 abort + 127
6  libsystem_c.dylib        0x00007fff61573868 basename_r + 0
7  clang-7                  0x000000010ac2b576 clang::CodeGen::CGRecordLayout::getLLVMFieldNo(clang::FieldDecl const*) const + 294
8  clang-7                  0x000000010ab5b1de emitAddrOfFieldStorage(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::FieldDecl const*) + 110
9  clang-7                  0x000000010ab47419 clang::CodeGen::CodeGenFunction::EmitLValueForField(clang::CodeGen::LValue, clang::FieldDecl const*) + 1337
10 clang-7                  0x000000010ab518c3 clang::CodeGen::CodeGenFunction::EmitMemberExpr(clang::MemberExpr const*) + 1075
11 clang-7                  0x000000010ab44401 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 1185
12 clang-7                  0x000000010ab4bc3c clang::CodeGen::CodeGenFunction::EmitCheckedLValue(clang::Expr const*, clang::CodeGen::CodeGenFunction::TypeCheckKind) + 172
13 clang-7                  0x000000010ab9188a (anonymous namespace)::ScalarExprEmitter::EmitLoadOfLValue(clang::Expr const*) + 42
14 clang-7                  0x000000010ab8e6ba clang::StmtVisitorBase<std::__1::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 15642
15 clang-7                  0x000000010ab94604 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) + 2244
16 clang-7                  0x000000010ab82f48 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 104
17 clang-7                  0x000000010ac60fe3 clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 1411
18 clang-7                  0x000000010ac5e123 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) + 1171
19 clang-7                  0x000000010ac664a0 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 96
20 clang-7                  0x000000010aca5503 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 787
21 clang-7                  0x000000010acbd256 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 486
22 clang-7                  0x000000010acb79d8 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 408
23 clang-7                  0x000000010acaf751 clang::CodeGen::CodeGenModule::EmitDeferred() + 289
24 clang-7                  0x000000010acaeacc clang::CodeGen::CodeGenModule::Release() + 28
25 clang-7                  0x000000010ad40ae4 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) + 100
26 clang-7                  0x000000010ac9bc38 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 120
27 clang-7                  0x000000010af3f91c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
28 clang-7                  0x000000010ba6a773 clang::ParseAST(clang::Sema&, bool, bool) + 531
29 clang-7                  0x000000010af0ac1e clang::FrontendAction::Execute() + 78
30 clang-7                  0x000000010aebc841 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1489
31 clang-7                  0x000000010af61479 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1945
32 clang-7                  0x00000001093033cb cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1403
33 clang-7                  0x0000000109301006 main + 10710
34 libdyld.dylib            0x00007fff61502ed9 start + 1
35 libdyld.dylib            0x0000000000000093 start + 2662322619
clang-7: error: unable to execute command: Abort trap: 6
clang-7: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 7.0.0 (git@github.com:apple/swift-clang.git 0b47a896d1de4f73e26db2dad1adbc1dd9a4252c) (git@github.com:apple/swift-llvm.git 8d1b92b83c0bd9735f4b8771b26ce96f8c2a3724) (based on LLVM 7.0.0)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-03-04-a.xctoolchain/usr/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7: note: diagnostic msg: /var/folders/hl/5lwrrzrx20d2h38qww1kr9x80000gn/T/render-82132d.c
clang-7: note: diagnostic msg: /var/folders/hl/5lwrrzrx20d2h38qww1kr9x80000gn/T/render-82132d.cache
clang-7: note: diagnostic msg: /var/folders/hl/5lwrrzrx20d2h38qww1kr9x80000gn/T/render-82132d.sh
clang-7: note: diagnostic msg: /var/folders/hl/5lwrrzrx20d2h38qww1kr9x80000gn/T/render-82132d.crash
clang-7: note: diagnostic msg: 

********************
@belkadan
Copy link
Contributor

Er, hang on, this is a crash in Clang. Did you mean to file it at https://bugs.llvm.org ?

@krzyzanowskim
Copy link
Contributor Author

@belkadan I really don't know what is the policy of the swift fork https://github.com/apple/swift-clang I really don't know.

@belkadan
Copy link
Contributor

Fair enough. The intent is that if the issue doesn't involve any Swift stuff, it's an llvm.org bug, but deciding whether something failing in Clang is or isn't Swift-related isn't something an average user should have to do. The Swift project is still responsible for the Clang we ship in Swift toolchains.

Do you want to file this over at bugs.llvm.org (so you can keep track of it) or should I?

@krzyzanowskim
Copy link
Contributor Author

unfortunately:

https://bugs.llvm.org/
New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Can you fill the bug for me, please?

@belkadan
Copy link
Contributor

Filed PR41060.

@MaxDesiatov
Copy link
Member

@krzyzanowskim I haven't had any problems when building cmark with clang recently, can we consider this issue resolved?

@krzyzanowskim
Copy link
Contributor Author

yea, I don't know how to validate this today. Maybe It's not a problem anymore.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants