[PATCH] D104667: Improve the diagnostic of DiagnosticInfoStackSize (and warn-stack-size in particular)

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 13:25:51 PDT 2021


MaskRay added a comment.

In D104667#2831488 <https://reviews.llvm.org/D104667#2831488>, @nickdesaulniers wrote:

> 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".

  % 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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104667/new/

https://reviews.llvm.org/D104667



More information about the llvm-commits mailing list