[Bug driver/92170] New: Incorrect function names output when using -fstack-usage on C++
austinpmorton at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 21 21:26:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92170
Bug ID: 92170
Summary: Incorrect function names output when using
-fstack-usage on C++
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: austinpmorton at gmail dot com
Target Milestone: ---
Created attachment 47075
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47075&action=edit
example source
When test.cc is compiled as follows:
g++ -c -fstack-usage test.cc
test.su contents appears as follows:
test.cc:12:34:<lambda(void*)> 16 static
test.cc:12:34:static void<lambda(void*)>::_FUN(void*) 24 static
test.cc:12:34:<lambda(void*)>::operator void (*)(void*)() const 16 static
test.cc:8:11:)>::fptr_t) [with RetT = void; ArgTs = {}] 16 static
test.cc:20:12:void __static_initialization_and_destruction_0(int, int) 48
static
test.cc:20:12:cc) 16 static
expected test.su contents as follows:
test.cc:12:26:<lambda(void*)> 16 static
test.cc:12:26:static void<lambda(void*)>::_FUN(void*) 24 static
test.cc:12:26:<lambda(void*)>::operator void (*)(void*)() const 16 static
test.cc:8:11:function_ref<RetT(ArgTs
...)>::function_ref(function_ref<RetT(ArgTs ...)>::fptr_t) [with RetT = void;
ArgTs = {}] 16 static
test.cc:20:12:void __static_initialization_and_destruction_0(int, int) 48
static
test.cc:20:12:(static initializers for test.cc) 16 static
This appears to be caused by code in output_stack_usage in toplev.c searching
for "." in the function name and only outputting after that point.
It is unclear to me what the intent was originally, but it dates back to the
original stack usage support commit (990495a75cd7).
I achieved the expected output shown above by applying the below patch to
disable the checks:
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 1c7002f5c37..a0b6cefd2d1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -981,6 +981,7 @@ output_stack_usage (void)
= strchr (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), '.');
const char *name
= lang_hooks.decl_printable_name (current_function_decl, 2);
+#if 0
if (suffix)
{
const char *dot = strchr (name, '.');
@@ -996,6 +997,7 @@ output_stack_usage (void)
if (dot)
name = dot + 1;
}
+#endif
fprintf (stack_usage_file,
"%s:%d:%d:%s\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n",
More information about the Gcc-bugs
mailing list