https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90809
Bug ID: 90809 Summary: -finstrument-functions-exclude-function-list mishandles comma escaping 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: --- Expected behavior: Escaping of comma in argument passed to -finstrument-functions-exclude-function-list flag would work the same as with -finstrument-functions-exclude-file-list. Observed behaviour: Escaping of comma in argument passed to -finstrument-functions-exclude-file-list flag causes the function specified to be instrumented (failure to match with comma escaped). Note comma escaping is necessary, as, for example, passing "test<float, float>" to the argument still disables the instrumentation of the "test<float, int>" functions, therefore the compiler is doing the substring matching as expected when the comma is not escaped, and finding that the "test<float" substring matches the "test<float, int>" function. GCC information: 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 used: gcc -finstrument-functions -finstrument-functions-exclude-function-list='test<float\, int>' main.cpp -o a.out -O0 Compiler gives no output (compiles silently). Observe that __cyg_profile_func_enter and __cyg_profile_func_exit calls are present in assembly implementation of "test<float, int>" function. main.ii included below: # 1 "main.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "main.cpp" template<class T, class U> T test(int a, T b){ int res = 0; for(int i = 0; i < 1000; i++){ res += i; } return(res); } int main(int argc, char** argv){ float a = test<float, int>(argc, 1.0); return(0); }