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

recursivelyAllWritableKeyPaths crash in specific case #476

Open
ematejska opened this issue Apr 30, 2020 · 0 comments
Open

recursivelyAllWritableKeyPaths crash in specific case #476

ematejska opened this issue Apr 30, 2020 · 0 comments

Comments

@ematejska
Copy link
Contributor

Imported from JIRA https://bugs.swift.org/browse/TF-1207

Type: Bug Priority: Minor
Reporter: Takehiro Araki Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment: swift-tensorflow-RELEASE-0.8.xctoolchain

If the target type has both Scalar parameter and Activation parameter, recursivelyAllWritableKeyPaths crash.

struct Model<Scalar: FloatingPoint&Differentiable>: KeyPathIterable {
    let scale: Scalar = 0
    let activation: Activation = { $0 }
    typealias Activation = @differentiable (Scalar) -> Scalar
}

let model = Model<Float>()
for kp in model.recursivelyAllWritableKeyPaths(to: Float.self) {
    print(model[keyPath: kp])
}
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.8.xctoolchain/usr/bin/swift -frontend -interpret main.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main 
1.	Swift version 5.2-dev (LLVM b3057cffb6, Swift da7410955d)
2.	While running user code "main.swift"
0  swift                    0x0000000112971e75 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x00000001129710b5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000011297245c SignalHandler(int) + 268
3  libsystem_platform.dylib 0x00007fff781b5b5d _sigtramp + 29
4  libsystem_platform.dylib 0x00000000000004b8 _sigtramp + 18446603338501106040
5  libswiftCore.dylib       0x000000011a97c059 $ss15KeyPathIterablePsE014recursivelyAllA5PathsSays07PartialaB0CyxGGvg + 1017
6  libswiftCore.dylib       0x000000011a97d602 $ss15KeyPathIterablePsE014recursivelyAllA5Paths2toSays0aB0Cyxqd__GGqd__m_tlF + 34
7  libswiftCore.dylib       0x000000011a97d91a $ss15KeyPathIterablePsE011allWritableA5Paths2toSays0eaB0Cyxqd__GGqd__m_tlFTm + 26
8  libswiftCore.dylib       0x000000011b0070ed $ss15KeyPathIterablePsE011allWritableA5Paths2toSays0eaB0Cyxqd__GGqd__m_tlFTm + 6854637
9  swift                    0x000000010e8d5a58 llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 456
10 swift                    0x000000010e8d8bf1 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 1297
11 swift                    0x000000010e8cbbdf swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions const&, swift::SILOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >&&) + 3471
12 swift                    0x000000010e8b494a performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 2378
13 swift                    0x000000010e8a9363 performCompile(swift::CompilerInstance&, swift::CompilerInvocation const&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 9299
14 swift                    0x000000010e8a5f48 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4472
15 swift                    0x000000010e83887d main + 861
16 libdyld.dylib            0x00007fff77fca3d5 start + 1
17 libdyld.dylib            0x000000000000000a start + 18446603338503117878
Segmentation fault: 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant