https://gcc.gnu.org/g:dbb7b2af2333b69707ffbea6a2a98830c37a0485
commit r17-713-gdbb7b2af2333b69707ffbea6a2a98830c37a0485 Author: Eric Botcazou <[email protected]> Date: Mon May 25 09:42:04 2026 +0200 Restore original format of -fstack-usage and add new second field This should minimize the backward compatibility breakage. gcc/ * doc/invoke.texi (fstack-usage): Document new second field. * toplev.cc (output_stack_usage_1): Revert latest changes and add the mangled name as the second field. gcc/testsuite/ * gcc.dg/stack-usage-1.c: Adjust. Diff: --- gcc/doc/invoke.texi | 10 ++++++---- gcc/testsuite/gcc.dg/stack-usage-1.c | 2 +- gcc/toplev.cc | 7 +++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8bfa73598c2f..b605defb3907 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -21095,15 +21095,17 @@ per-function basis. The filename for the dump is made by appending @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename of the source file. An entry is made up -of three fields: +of four fields separated by tabulation characters: @itemize @item -The name of the function. +The name of the function preceded by its source location @item -A number of bytes. +The mangled name of the function @item -One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. +A number of bytes +@item +One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded} @end itemize The qualifier @code{static} means that the function manipulates the stack diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 1ba9d059956b..f46e1cf983ca 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 `foo`\t\(256|264\)\tstatic" } } */ +/* { dg-final { scan-stack-usage "foo\tfoo\t\(256|264\)\tstatic" } } */ /* { dg-final { cleanup-stack-usage } } */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 7925462bc583..3d4319fa3286 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -840,12 +840,11 @@ output_stack_usage_1 (FILE *cf) if (stack_usage_file) { print_decl_identifier (stack_usage_file, current_function_decl, - PRINT_DECL_ORIGIN | PRINT_DECL_UNIQUE_NAME + PRINT_DECL_ORIGIN | PRINT_DECL_NAME | PRINT_DECL_REMAP_DEBUG); - fprintf (stack_usage_file, " `"); + fputs ("\t", stack_usage_file); print_decl_identifier (stack_usage_file, current_function_decl, - PRINT_DECL_NAME); - fprintf (stack_usage_file, "`"); + PRINT_DECL_UNIQUE_NAME); fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n", stack_usage, stack_usage_kind_str[stack_usage_kind]); }
