Before: warning: stack size limit exceeded (888) in main (the limit (-Wframe-larger-than) is not mentioned)
After: warning: stack frame size (888) exceeds limit (100) in function 'main'
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
GCC trunk: warning: the frame size of 80 bytes is larger than 0 bytes [-Wframe-larger-than=]
Clang trunk: warning: stack frame size of 88 bytes in function 'bar' [-Wframe-larger-than]
looks like the frontend doesn't use this particular text at all?
This diagnostic is emitted by clang (clang/lib/CodeGen/CodeGenAction.cpp).
-Wframe-larger-than= also records the module flag metadata "warn-stack-size" which can be useful for LTO.
% fclang -Wframe-larger-than=100 a.c -o x a.c:1:5: warning: stack frame size of 888 bytes in function 'main' [-Wframe-larger-than] int main(){ ^ 1 warning generated. % fclang -Wframe-larger-than=100 -flto=thin -fuse-ld=lld a.c -o x ld.lld: warning: stack size limit exceeded (888) in main
Can we try to make the FE match what's printed during LTO? It's odd that they differ, IMO. Also, GCC prints the threshold value, as does our backend; but the frontend still does not.
How about warning: stack frame size (88) exceeds limit (80) in function 'warn' for "warn-stack-size" (currently a module flag metadata, will soon become a function attribute)?
I can make the clang diagnostic match this style, too.
How about warning: stack frame size (88) exceeds limit (80) in function 'warn'
Sure. Would you mind adding the before/after text to the commit description as well, please?
stack size -> stack frame size
The former is ambiguous (it could mean the full stack size).
clang/test/Misc/backend-resource-limit-diagnostics.cl | ||
---|---|---|
4 | The value of the limit is still not printed though. Oh, we don't print (0) if the limit is 0? Perhaps add a --check-prefix and additional RUN line that exercises a non-zero limit from the frontend? |
This will need to be rebased on https://reviews.llvm.org/rG8ace12130526f450c822ca232d1f865b247d7434 and the tests updated, potentially.
clang/test/Misc/backend-resource-limit-diagnostics.cl | ||
---|---|---|
4 | 0 means the diagnostic does not convey the limit information. It needs more refactoring to make this happen... and probably should not be the job of this patch... |
The value of the limit is still not printed though.
Oh, we don't print (0) if the limit is 0? Perhaps add a --check-prefix and additional RUN line that exercises a non-zero limit from the frontend?