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-12650] Add type mangling for @noDerivative parameters #55094

Closed
dan-zheng opened this issue Apr 22, 2020 · 1 comment
Closed

[SR-12650] Add type mangling for @noDerivative parameters #55094

dan-zheng opened this issue Apr 22, 2020 · 1 comment
Assignees
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself

Comments

@dan-zheng
Copy link
Contributor

Previous ID SR-12650
Radar None
Original Reporter @dan-zheng
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, AutoDiff
Assignee @dan-zheng
Priority Medium

md5: 0138d915a8f5fba2978215c741cdafeb

Issue Description:

import _Differentiation
func id(_ x: Float, _ y: Float) -> Float { x }
let transformed: @differentiable (Float, @noDerivative Float) -> Float = id

IRGenDebugInfo crashes without @noDerivative parameter type mangling.

$ swiftc -g noderiv.swift
Incorrect reconstructed type for $sS3fIedgyyd_D
Original type:
(sil_function_type type=@differentiable @callee_guaranteed (Float, @noDerivative Float) -> Float
  (input=struct_type decl=Swift.(file).Float)
  (input=struct_type decl=Swift.(file).Float)
  (result=struct_type decl=Swift.(file).Float)
  (substitution_map generic_signature=<nullptr>)
  (substitution_map generic_signature=<nullptr>))
Reconstructed type:
(sil_function_type type=@differentiable @callee_guaranteed (Float, Float) -> Float
  (input=struct_type decl=Swift.(file).Float)
  (input=struct_type decl=Swift.(file).Float)
  (result=struct_type decl=Swift.(file).Float)
  (substitution_map generic_signature=<nullptr>)
  (substitution_map generic_signature=<nullptr>))
Stack dump:
...
1.  Swift version 5.3-dev (LLVM 803d1b184d, Swift 477af9f90d)
2.  While evaluating request IRGenSourceFileRequest(IR Generation for file "noderiv.swift")
0  swift                    0x00000001104c7ae8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001104c6a68 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x00000001104c80dd SignalHandler(int) + 285
3  libsystem_platform.dylib 0x00007fff718335fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338611739168
5  libsystem_c.dylib        0x00007fff71709808 abort + 120
6  swift                    0x0000000110604152 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.20) + 146
7  swift                    0x000000010c24ab1e (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3614
8  swift                    0x000000010c245437 swift::irgen::IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalVariable*, llvm::StringRef, llvm::StringRef, swift::irgen::DebugTypeInfo, bool, bool, llvm::Optional<swift::SILLocation>) + 167
@dan-zheng
Copy link
Contributor Author

Done in #31201

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself
Projects
None yet
Development

No branches or pull requests

1 participant