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-8468] Performance issue when parsing a crafted swift source code #50989

Open
swift-ci opened this issue Aug 6, 2018 · 1 comment
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 6, 2018

Previous ID SR-8468
Radar None
Original Reporter hongxuchen (JIRA User)
Type Bug
Environment

Swift version 4.2-dev (LLVM a4d539e482, Clang 773ac0251a, Swift b3c9dbe)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser
Assignee None
Priority Medium

md5: 250542fe35acc2f49d74def400b4c502

Issue Description:

When parsing some source code that containing several "[", it may have performance issue while use significant resources. For example, when running the following code snippets below, swiftc may just hang there and the computer may lag very much when the situation lasts longer (after one hour).

# h_01.swift
func myfunc() -> Bool {
 return [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ == 1
}
# h_02.swift
func myfunc() {
 [[[[[[[[[[[[[[[[[[[[[_ = Selector("")
}
# h_03.swift
func myfunc() {
 [[[[[[[[[[[[[[[[[[[[[[ + ""
}
# h_04.swift
func myfunc() {
 [[[[[[[[[[[[[[[[[[[[[[ | wrong
}
@belkadan
Copy link
Contributor

belkadan commented Aug 6, 2018

Looks like some very bad recovery in the parser. @rintaro?

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

No branches or pull requests

2 participants