[llvm-dev] Implementing "-Wstack-usage=" warning flag
David Blaikie via llvm-dev
llvm-dev at lists.llvm.org
Wed May 5 18:55:31 PDT 2021
+Roman Lebedev
Roman - what was your particular motivation for filing the bug? Is
there a use case that -Wframe-larger-than doesn't cover? Would
-Wstack-usage as an alias for -Wframe-larger-than be adequate for your
use case (if directly using the existing flag is not sufficient for
some reason)?
On Wed, May 5, 2021 at 6:32 PM Ryan Santhirarajan via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Hello everyone,
>
>
>
> I am trying to address the following bug:
> https://bugs.llvm.org/show_bug.cgi?id=44418
>
> Which asks for the implementation of the missing “-Wstack-usage=” which will report, on a per-function basis, if the stack usage exceeds the user input.
>
>
>
> My first approach at implementing “-Wstack-usage” is the following:
>
> https://reviews.llvm.org/D101965
>
> This is virtually identical to the output of “-Wframe-larger-than” on clang. However when observing the behaviour of GCC I noticed that GCC outputs different values for “-Wstack-usage” and “-Wframe-larger-than”.
>
>
>
> This led me to my second approach which changes the way clang reports “-Wframe-larger-than”. This can be found here:
> https://reviews.llvm.org/D101964
>
> With this second approach, “-Wframe-larger-than” now reports the stack size minus any space allocated on the stack for the parameters of called functions. This more closely resembles GCC’s behaviour.
>
>
>
> I am unsure which implementation is preferred/correct and I am wondering if anyone can comment or provide some information on what a better approach would be, and what exactly the two flags should be reporting.
>
>
>
> Thanks,
>
> Ryan Santhirarajan
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list