-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
| Previous ID | SR-14315 |
| Radar | rdar://problem/75178446 |
| Original Reporter | @Lukasa |
| Type | Bug |
Environment
Swift 5.3.3-RELEASE on Ubuntu 20.04
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 37147dd19c120d6292c0a4b518293fed
Issue Description:
Place the following content into a file called test.swift.
final class MyType {
var count: Int = 55
}
@_cdecl("mytype_create")
public func mytype_create() -> OpaquePointer {
let type = MyType()
let retained = Unmanaged.passRetained(type).toOpaque()
return OpaquePointer(retained)
}
@_cdecl("mytype_get_count")
public func mytype_create(_ type: OpaquePointer) -> CInt {
let type = Unmanaged<MyType>.fromOpaque(UnsafeRawPointer(type)).takeUnretainedValue()
return CInt(type.count)
}Attempt to compile with swiftc -emit-objc-header-path test.h test.swift.
This triggers the following assertion:
swift: /home/buildnode/jenkins/workspace/oss-swift-5.3-package-linux-ubuntu-16_04/swift/lib/PrintAsObjC/ModuleContentsWriter.cpp:503: auto (anonymous namespace)::ModuleWriter::write()::(anonymous class)::operator()(swift::Decl *const *, swift::Decl *const *) const: Assertion `!(isa<ValueDecl>(*lhs) && isa<ValueDecl>(*rhs))' failed.
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -merge-modules -emit-module /tmp/test-e4af15.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -emit-module-doc-path test.swiftdoc -emit-module-source-info-path test.swiftsourceinfo -emit-objc-header-path test.h -module-name test -o test.swiftmodule
1. Swift version 5.3.3 (swift-5.3.3-RELEASE)
2. While generating Objective-C header
/usr/bin/swift[0x50aee34]
/usr/bin/swift[0x50ace00]
/usr/bin/swift[0x50af11a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fba52cfe390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7fba5142b438]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7fba5142d03a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbe7)[0x7fba51423be7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc92)[0x7fba51423c92]
/usr/bin/swift[0x699d40]
/lib/x86_64-linux-gnu/libc.so.6(+0x39242)[0x7fba5142f242]
/lib/x86_64-linux-gnu/libc.so.6(qsort_r+0x3cf)[0x7fba5142f6af]
/usr/bin/swift[0x6988a7]
/usr/bin/swift[0x69688f]
/usr/bin/swift[0x54450e]
/usr/bin/swift[0x1a9800b]
/usr/bin/swift[0x540036]
/usr/bin/swift[0x57e411]
/usr/bin/swift[0x587bcf]
/usr/bin/swift[0x57b322]
/usr/bin/swift[0x5780ef]
/usr/bin/swift[0x501c2c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fba51416840]
/usr/bin/swift[0x5017a9]
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: merge-module command failed due to signal 6 (use -v to see invocation)Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself