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

Clang crashes segmentation fault due to stack overflow on deeply nested expressions #111699

Closed
bricknerb opened this issue Oct 9, 2024 · 3 comments · Fixed by #111701
Closed
Assignees
Labels
clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@bricknerb
Copy link
Contributor

bricknerb commented Oct 9, 2024

For example, if you do ~10,000 nested expression calls like this one:

a.foo().foo().foo() ...

You will get a segmentation fault crash.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Oct 9, 2024
@EugeneZelenko EugeneZelenko added clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Oct 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2024

@llvm/issue-subscribers-clang-codegen

Author: Boaz Brickner (bricknerb)

For example, if you do 1,000 nested expression calls like this one:

a.foo().foo().foo() ...

You will get a segmentation fault crash.

@tbaederr
Copy link
Contributor

Is this based on an actual crash or just theoretical?

@bricknerb
Copy link
Contributor Author

Yes, clang actually crashed on actual use case we had.
More details are in swiftlang/swift#76387.

ilya-biryukov pushed a commit that referenced this issue Oct 14, 2024
…ted expressions (#111701)

Done by calling clang::runWithSufficientStackSpace().
Added CodeGenModule::runWithSufficientStackSpace() method similar to the
one in Sema to provide a single warning when this triggers
Fixes: #111699
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this issue Oct 16, 2024
…ted expressions (llvm#111701)

Done by calling clang::runWithSufficientStackSpace().
Added CodeGenModule::runWithSufficientStackSpace() method similar to the
one in Sema to provide a single warning when this triggers
Fixes: llvm#111699
bricknerb added a commit to bricknerb/llvm-project that referenced this issue Oct 17, 2024
…ted expressions (llvm#111701)

Done by calling clang::runWithSufficientStackSpace().
Added CodeGenModule::runWithSufficientStackSpace() method similar to the
one in Sema to provide a single warning when this triggers
Fixes: llvm#111699
EricWF pushed a commit to efcs/llvm-project that referenced this issue Oct 22, 2024
…ted expressions (llvm#111701)

Done by calling clang::runWithSufficientStackSpace().
Added CodeGenModule::runWithSufficientStackSpace() method similar to the
one in Sema to provide a single warning when this triggers
Fixes: llvm#111699
@bricknerb bricknerb self-assigned this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
4 participants