-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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.c interopFeature: Interoperability with CFeature: Interoperability with C
Description
Description
swift-atomics has a C header imported by Swift, and it contains a C function declaration with SwiftCC.
https://github.com/apple/swift-atomics/blob/cd142fd2f64be2100422d658e7411e39489da985/Sources/_AtomicsShims/include/_AtomicsShims.h#L25
However, the caller side of the function does not use SwiftCC, and it causes calling convention violation.
Steps to reproduce
Here is a lit test case to reproduce the issue
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend -I%t %t/caller.swift -emit-ir | %FileCheck %s
//--- c_funcs.h
__attribute__((swiftcall))
extern void with_swiftcc(void);
//--- module.modulemap
module c_funcs {
header "c_funcs.h"
}
//--- caller.swift
import c_funcs
func test() {
// CHECK: call swiftcc void @with_swiftcc()
with_swiftcc()
}
// CHECK: declare swiftcc void @with_swiftcc()
test()
Environment
- Swift compiler version info 41dc466
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.c interopFeature: Interoperability with CFeature: Interoperability with C