https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90816
Bug ID: 90816
Summary: -finstrument-functions-exclude-function-list
improperly handles namespace/class definitions
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: oliverbrowne627 at gmail dot com
Target Milestone: ---
Tested with following GCC version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/tools/batonroot/rodin/devkits/lnx64/gcc-6.2.0/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../../src/lnx64/configure
--prefix=/tools/batonroot/rodin/devkits/lnx64/gcc-6.2.0
--enable-languages=c,c++
--with-ppl=/tools/batonroot/rodin/devkits/lnx64/ppl-0.11
--with-cloog=/tools/batonroot/rodin/devkits/lnx64/cloog-ppl-0.15.11
LDFLAGS=-L/tools/batonroot/rodin/devkits/lnx64/cloog-ppl-0.15.11/lib
Thread model: posix
gcc version 6.2.0 (GCC)
GCC Command:
gcc -finstrument-functions
-finstrument-functions-exclude-function-list='TestClass::test' main.cpp -o
a.out -O0
Description of issue:
__cyg_profile_func_enter and __cyg_profile_func_exit present in TestClass::test
implementation in output file despite symbol passed to
-finstrument-functions-exclude-function-list.
Suspected to be due to:
-> lang_hooks.decl_printable_name (fndecl, 0);
-> from gcc/gimplify.c, flag_instrument_functions_exclude_p, line 13992
only returning the local name of the function.
Main.cpp:
class TestClass{
public:
int test(){
int res = 0;
for(int i = 0; i < 1000; i++){
res += i;
}
return(res);
}
};
int main(int argc, char** argv){
TestClass t = TestClass();
t.test();
return(0);
}
Implementation of TestClass.test():
0000000000400592 <TestClass::test()>:
400592: 55 push %rbp
400593: 48 89 e5 mov %rsp,%rbp
400596: 53 push %rbx
400597: 48 83 ec 28 sub $0x28,%rsp
40059b: 48 89 7d d8 mov %rdi,-0x28(%rbp)
40059f: 48 8b 45 08 mov 0x8(%rbp),%rax
4005a3: 48 89 c6 mov %rax,%rsi
4005a6: bf 92 05 40 00 mov $0x400592,%edi
4005ab: e8 80 fe ff ff callq 400430
<__cyg_profile_func_enter@plt>
4005b0: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%rbp)
4005b7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%rbp)
4005be: 81 7d ec e7 03 00 00 cmpl $0x3e7,-0x14(%rbp)
4005c5: 7f 11 jg 4005d8 <TestClass::test()+0x46>
4005c7: 8b 55 e8 mov -0x18(%rbp),%edx
4005ca: 8b 45 ec mov -0x14(%rbp),%eax
4005cd: 01 d0 add %edx,%eax
4005cf: 89 45 e8 mov %eax,-0x18(%rbp)
4005d2: 83 45 ec 01 addl $0x1,-0x14(%rbp)
4005d6: eb e6 jmp 4005be <TestClass::test()+0x2c>
4005d8: 8b 5d e8 mov -0x18(%rbp),%ebx
4005db: 48 8b 45 08 mov 0x8(%rbp),%rax
4005df: 48 89 c6 mov %rax,%rsi
4005e2: bf 92 05 40 00 mov $0x400592,%edi
4005e7: e8 34 fe ff ff callq 400420
<__cyg_profile_func_exit@plt>
4005ec: 89 d8 mov %ebx,%eax
4005ee: 48 83 c4 28 add $0x28,%rsp
4005f2: 5b pop %rbx
4005f3: 5d pop %rbp
4005f4: c3 retq
4005f5: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
4005fc: 00 00 00
4005ff: 90 nop