> I submitted the patch formally here:
> https://gcc.gnu.org/pipermail/gcc-patches/2026-May/717765.html
Thanks, but the back-ticks are too awkward, so I have restored the original
format and added the mangled name as a new second field, so that scripts can
just look at the last three fields. I have also updated the documentation.
Tested on x86-64/Linux, applied on the mainline.
* 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.dg/stack-usage-1.c: Adjust.
--
Eric Botcazoudiff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8bfa73598c2..b605defb390 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 1ba9d059956..f46e1cf983c 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 7925462bc58..3d4319fa328 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]);
}