Skip to content

clang frontend crash due to an exponential complexity of typo corrector #43925

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 44580
Version unspecified
OS All
Attachments typos.cpp from description
Reporter LLVM Bugzilla Contributor
CC @dwblaikie,@DougGregor,@zygoloid,@Weverything

Extended Description

Compiling typos.cpp ends with an "LLVM ERROR: out of memory"

typos.cpp is a very simple file with n=10 int definitions and a function call with n arguments.
When clang analyzes this file it tries to correct typos in it. In order to do this it calls method clangSema::SemaExprCXX.cpp::CheckAndAdvanceTypoExprCorrectionStreams

The problem is that amount of calls is around 8^(n-1), which leads to a crash or infinitely long waiting time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyhangCompiler hang (infinite loop)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions