-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Crash in Clang when using sizeof(int[vec.size()]) with invalid std::vector initialization since version 19.0 #138444
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
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
crash-on-invalid
Comments
@llvm/issue-subscribers-clang-frontend Author: None (mariete1223)
## Summary
Clang crashes with an internal compiler error when evaluating sizeof(int[vec.size()]) where vec is incorrectly initialized from an int.
AssertionNo assertion appears Stack dump
Program
To quickly reproduceIt happens in versions 19, 20 and current. |
Looks likes that the crash happens when trying to constant-folding the VLA size. |
Reduced test case:
|
AaronBallman
added a commit
to AaronBallman/llvm-project
that referenced
this issue
May 5, 2025
Transforming an expression to a potentially evaluated expression can fail. If it does so, no longer attempt to make the type trait expression, instead return an error expression. This ensures we don't try to compute the dependence for an invalid type. Fixes llvm#138444
AaronBallman
added a commit
that referenced
this issue
May 5, 2025
Transforming an expression to a potentially evaluated expression can fail. If it does so, no longer attempt to make the type trait expression, instead return an error expression. This ensures we don't try to compute the dependence for an invalid type. Fixes #138444
GeorgeARM
pushed a commit
to GeorgeARM/llvm-project
that referenced
this issue
May 7, 2025
Transforming an expression to a potentially evaluated expression can fail. If it does so, no longer attempt to make the type trait expression, instead return an error expression. This ensures we don't try to compute the dependence for an invalid type. Fixes llvm#138444
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
crash-on-invalid
Summary
Clang crashes with an internal compiler error when evaluating sizeof(int[vec.size()]) where vec is incorrectly initialized from an int.
Assertion
No assertion appears
Stack dump
Program
To quickly reproduce
It happens in versions 19, 20 and current.
https://gcc.godbolt.org/z/Krh4bPqTY
The text was updated successfully, but these errors were encountered: