http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57227
Bug ID: 57227 Summary: Two function with identical signature but different calling convention seem to be symbol-encoded by the same string Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ondrej.kolacek at centrum dot cz Consider following snippet in which we specialize Decider template with dummyd and dummye functions which only differ in calling convention: int dummyd() { return 110; } int __attribute__((__stdcall__)) dummye() { return 1; } template<typename T> bool Decider(T && ) { return true; } int main() { Decider(dummyd); Decider(dummye); return 0; } trying to compile this results into assembler error: test2.s: Assembler messages: test2.s:112: Error: symbol `_Z7DeciderIRFivEEbOT_' is already defined It seems to me that while g++ knows about dummyd and dummye having different calling convention, it hands to the assembler two equal symbol names. I have seen one bug which may be duplicate of this - bug 29328, but 1) the issue may be slightly different, as in my case compiler evidently treats the two specializations as different types 2) the bug is rotting there for 7 years now so making a new one could stir things up g++-4.7 -v -save-temps -g test2.cpp -std=c++11 -m32 -Wall -Wextra Using built-in specs. COLLECT_GCC=g++-4.7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-g' '-std=c++11' '-m32' '-Wall' '-Wextra' '-shared-libgcc' '-mtune=generic' '-march=i586' /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -E -quiet -v -imultilib 32 -imultiarch i386-linux-gnu -D_GNU_SOURCE test2.cpp -m32 -mtune=generic -march=i586 -std=c++11 -Wall -Wextra -g -fworking-directory -fpch-preprocess -o test2.ii ignoring nonexistent directory "/usr/local/include/i386-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/c++/4.7 /usr/include/c++/4.7/x86_64-linux-gnu/32 /usr/include/c++/4.7/backward /usr/lib/gcc/x86_64-linux-gnu/4.7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/i386-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-g' '-std=c++11' '-m32' '-Wall' '-Wextra' '-shared-libgcc' '-mtune=generic' '-march=i586' /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -fpreprocessed test2.ii -quiet -dumpbase test2.cpp -m32 -mtune=generic -march=i586 -auxbase test2 -g -Wall -Wextra -std=c++11 -version -o test2.s GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 66d178dd81da8c975e003e06d9f5e782 COLLECT_GCC_OPTIONS='-v' '-save-temps' '-g' '-std=c++11' '-m32' '-Wall' '-Wextra' '-shared-libgcc' '-mtune=generic' '-march=i586' as -v --32 -o test2.o test2.s GNU assembler version 2.22 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.22 test2.s: Assembler messages: test2.s:112: Error: symbol `_Z7DeciderIRFivEEbOT_' is already defined [kolaceko@lce:~/proj/2/avg/mk]$