https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91402
Bug ID: 91402 Summary: PowerPC unecessary -Wignored-attriubte warnings on template specialization with -mlongcall Product: gcc Version: 7.4.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andrewdkaster at gmail dot com Target Milestone: --- Host: x86_64-linux-gnu Target: powerpc-linux-gnu Build: x86_64-linux-gnu Created attachment 46690 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46690&action=edit Reproducer When using the option -mlongcall for powerpc, g++ appears to treat my template parameter for my template specialization as a function declaration and add the longcall attribute, which then is later ignored and generates a warning. ~: powerpc-linux-gnu-g++ -mlongcall -Wall -Wextra -c test.cpp -o test.o test.cpp:5:15: warning: ignoring attributes on template argument ‘R(A)’ [-Wignored-attributes] struct S <R(A)> {}; ^ test.cpp:11:18: warning: ignoring attributes on template argument ‘Ret(Arg)’ [-Wignored-attributes] struct D<Ret(Arg)> { ^ I am using this class to wrap a generic delegate, per the second example. Tested on Ubuntu 18.04.03, powerpc-linux-gnu-g++ version 7.4.0 ~: powerpc-linux-gnu-g++ -v Using built-in specs. COLLECT_GCC=powerpc-linux-gnu-g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/powerpc-linux-gnu/7/lto-wrapper Target: powerpc-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --enable-secureplt --disable-softfloat --with-cpu=default32 --disable-softfloat --enable-targets=powerpc-linux,powerpc64-linux --enable-multiarch --disable-werror --with-long-double-128 --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=powerpc-linux-gnu --program-prefix=powerpc-linux-gnu- --includedir=/usr/powerpc-linux-gnu/include Thread model: posix gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1) The same results happen when using a version of g++ 8.1 obtained from WindRiver to target PowerPC VxWorks (running on Rhel-7): ./powerpc-linux-gnu-g++ -v Reading specs from /opt/workbench4-r2/compilers/gnu-8.1.0.1/x86_64-linux2/bin/../lib/gcc/powerpc-linux-gnu/8.1.0/../../../../powerpc-linux-gnu/lib/specs COLLECT_GCC=./powerpc-linux-gnu-g++ COLLECT_LTO_WRAPPER=/opt/workbench4-r2/compilers/gnu-8.1.0.1/x86_64-linux2/bin/../libexec/gcc/powerpc-linux-gnu/8.1.0/lto-wrapper Target: powerpc-linux-gnu Configured with: /folk/prj-llvm-build/gcc/build-storage/master/20190313_161647/wr-gcc/gcc/configure --target=powerpc-linux-gnu --prefix=/usr/local/wind/tmp/compilers --with-pkgversion='Wind River VxWorks GCC 8.1.0.1 - 2019.03.13' --disable-nls --enable-languages=c,c++ --enable-targets=all --disable-multilib --enable-threads --enable-tls --enable-__cxa_atexit --enable-secureplt Thread model: posix gcc version 8.1.0 (Wind River VxWorks GCC 8.1.0.1 - 2019.03.13)