https://gcc.gnu.org/g:960895db66868a81fafbebe4392bf0f1054fc101
commit r17-704-g960895db66868a81fafbebe4392bf0f1054fc101 Author: Andrew Pinski <[email protected]> Date: Mon May 18 18:20:14 2026 -0700 stack_usage: Print out the user visibility name too Since the output here should be usable via humans, we should print out the user realable name and not just the mangled name. For C, that means we print out the same name twice which is fine. The mangled name is useful to correspond the assembly with the stack usage too. For C++ it will something like: t.c:2:5:_Z5unopti `int unopt(int)` 16 static Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * toplev.cc (output_stack_usage_1): Print out the human readable name in quotes. gcc/testsuite/ChangeLog: * gcc.dg/stack-usage-1.c: Update testcase. Signed-off-by: Andrew Pinski <[email protected]> Diff: --- gcc/testsuite/gcc.dg/stack-usage-1.c | 2 +- gcc/toplev.cc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 8714c57c197b..1ba9d059956b 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -116,5 +116,5 @@ int foo (void) return 0; } -/* { dg-final { scan-stack-usage "foo\t\(256|264\)\tstatic" } } */ +/* { dg-final { scan-stack-usage "foo `foo`\t\(256|264\)\tstatic" } } */ /* { dg-final { cleanup-stack-usage } } */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 66fa927c53d3..7925462bc583 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -842,6 +842,10 @@ output_stack_usage_1 (FILE *cf) print_decl_identifier (stack_usage_file, current_function_decl, PRINT_DECL_ORIGIN | PRINT_DECL_UNIQUE_NAME | PRINT_DECL_REMAP_DEBUG); + fprintf (stack_usage_file, " `"); + print_decl_identifier (stack_usage_file, current_function_decl, + PRINT_DECL_NAME); + fprintf (stack_usage_file, "`"); fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n", stack_usage, stack_usage_kind_str[stack_usage_kind]); }
