Grdb.swift: Swift 5 compiler crash

Created on 25 Jan 2019  路  12Comments  路  Source: groue/GRDB.swift

Xcode 10.2 Beta 1


crash log

1.  While emitting SIL for 'performInsert(_:)' (at /Users/yarshure/github/sfsocket/Carthage/Checkouts/GRDB_project_name_temp/GRDB/Record/PersistableRecord.swift:942:12)
2.  While silgen emitFunction SIL function "@$s4GRDB17PersistableRecordPAAE13performInsertyyAA8DatabaseCKF".
 for 'performInsert(_:)' (at /Users/yarshure/github/sfsocket/Carthage/Checkouts/GRDB_project_name_temp/GRDB/Record/PersistableRecord.swift:942:12)
0  swift                    0x00000001041fcf8a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x00000001041fc77c SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff6f4f1b3d _sigtramp + 29
3  libsystem_malloc.dylib   0x00007fff6f4b8b54 tiny_free_no_lock + 1035
4  swift                    0x000000010101c5ec swift::ASTVisitor<SILGenLValue, swift::Lowering::LValue, void, void, void, void, void, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions>::visit(swift::Expr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions) + 1436
5  swift                    0x000000010101bf82 swift::Lowering::SILGenFunction::emitLValue(swift::Expr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions) + 34
6  swift                    0x0000000100f782f3 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1443
7  swift                    0x0000000100f8a0c5 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 1061
8  swift                    0x0000000100f873bb (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1339
9  swift                    0x0000000100f84e2b (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2763
10 swift                    0x0000000100f80f3b swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 2235
11 swift                    0x0000000100ff342b swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 811
12 swift                    0x0000000101050443 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 10403
13 swift                    0x0000000101053084 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 21732
14 swift                    0x00000001010503e8 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 10312
15 swift                    0x000000010100741b swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 427
16 swift                    0x0000000100f664ce swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 1006
17 swift                    0x000000010105f737 swift::Lowering::SILGenModule::visitExtensionDecl(swift::ExtensionDecl*) + 151
18 swift                    0x0000000100f70916 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1206
19 swift                    0x0000000100f725e5 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1253
20 swift                    0x000000010052e130 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 26896
21 swift                    0x000000010052440f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6351
22 swift                    0x00000001004c5adb main + 1243
23 libdyld.dylib            0x00007fff6f306ed9 start + 1
24 libdyld.dylib            0x00000000000000cb start + 2429522419
error: Segmentation fault: 11

support

Most helpful comment

Hello @yarshure,

This is a bug in the Swift 5 compiler: SR-9707.

We'll have to wait until it is fixed. Unless somebody has a genius idea.

All 12 comments

Hello @yarshure,

This is a bug in the Swift 5 compiler: SR-9707.

We'll have to wait until it is fixed. Unless somebody has a genius idea.

The latest Swift 5 snapshot, from February 3, 2019, does no longer exhibit this crash 馃憤

Let's keep this issue open until Xcode beta is fixed as well.

Xcode beta 2 still crash :(

C'mon apple, i'm tired because of the "microphone access" bug, corrected with Xcode 10.2 but can't use it because of the crash with GRDB...

Edit: Tested with the snapshot version of swift, it don't crash anymore with GRDB, fine, but it crash with another lib.

GRDB support for Swift 5 has started in the swift-5.0 branch (with the latest Swift 5 snapshot). Just like Xcode betas, this is unfinished software. If it doesn't work for you, your help and support are welcome.

I'll try to sum up my plans regarding Swift 5 in a future message.

EDIT 2018/02/20: please stop using the swift-5.0 branch. Check
https://github.com/groue/GRDB.swift/issues/472#issuecomment-465456228

@skrew:

:(

Take a deep breath, it will get better :-)

Xcode beta 2 came out on the 4th, only a day after the Swift branch that fixed it. The timing was poor for beta 2 to include the fix. Hopefully beta 3 include the fix.

Building works in Xcode beta 3!

Thanks @graham-perks-snap!

:warning: The swift-5.0 quoted above is a short-lived branch. It will be deleted soon: don't rely on it.

馃憠 Instead, GRDB users who use Xcode 10.2 beta are encouraged to switch to GRDB 4, currently in development in the GRDB-4.0 branch. For more details, read the first paragraphs of the README.

The master README has been updated with Swift 5 information. Since all needed information is now easily available, I'm closing this issue.

Thanks @groue. Since GRDB 4 has no ETA (per the readme), this leaves users stranded on Xcode 9, which of course none of us will want to sit on for long.

Since GRDB 4 has no ETA (per the readme), this leaves users stranded on Xcode 9, which of course none of us will want to sit on for long.

There is no ETA, but there is an estimated backlog in #479.

And there are other options than sitting on GRDB 3.6.2 and Xcode 10.1:

  1. Fork GRDB 3 so that it is compatible with Xcode 10.2 beta.
  2. Same as previous options, and submit a pull request so that other users can profit from your experience.
  3. Same as previous options, with production-grade quality (all guarantees of semantic versioning must apply): this will eventually give the very last GRDB 3 version: GRDB 3.6.3, and this would be really great.
  4. Upgrade your GRDB dependency on GRDB 4 (ok with Xcode 10.0, Xcode 10.1, and Xcode 10.2 beta)
  5. Same as the previous option, and help decreasing the ETA with your contributions.

My personal priorities are on GRDB 4, because this is where there is the most benefits for everybody. It should already be pretty usable, even if we can expect a few breaking changes until the final release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ruslandoga picture ruslandoga  路  3Comments

chiliec picture chiliec  路  7Comments

mallman picture mallman  路  5Comments

mtancock picture mtancock  路  3Comments

mregnauld picture mregnauld  路  5Comments