[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 --- Comment #9 from Kevin Puetz --- I accidentally dropped a word, meant to say: I'm not directly arguing for (or against) a backport to (a hypothetical 9.5.0) Just noting that this issue could also manifest as wrong-code, for consideration in case there's going to be one.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Kevin Puetz changed: What|Removed |Added CC||puetzk at puetzk dot org --- Comment #8 from Kevin Puetz --- This bug can also manifest as wrong-code, e.g. >>> template struct func_ptr_t; template struct func_ptr_t { using type = void(*)(T); }; template struct func_ptr_t { #if 1 using type = void(__attribute__((__stdcall__))*)(T); #else using type = void(__attribute__((__stdcall__))*)(int); // this works, using T is important somehow #endif }; #if 1 using foo_stdcall_ptr = func_ptr_t::type; using foo_cdecl_ptr = func_ptr_t::type; #else using foo_stdcall_ptr = void(__attribute__((__stdcall__))*)(int,int); using foo_cdecl_ptr = void(*)(int,int); #endif foo_stdcall_ptr foo_stdcall; foo_cdecl_ptr foo_cdecl; void bar_stdcall() { foo_stdcall(1); } void bar_cdecl() { foo_cdecl(1); } >>> Should compile so that the bar_stdcall versions pops fewer bytes off the stack (as foo_stdcall already cleaned up its own arguments). >>> --- bar_cdecl.S 2021-03-09 00:54:58.404022904 + +++ bar_stdcall.S 2021-03-09 00:52:07.900015002 + @@ -1,15 +1,15 @@ -: +: 0: f3 0f 1e fb endbr32 4: 55 push %ebp 5: 89 e5 mov%esp,%ebp 7: 83 ec 08sub$0x8,%esp - a: e8 fc ff ff ff call 32 + a: e8 fc ff ff ff call b f: 05 01 00 00 00 add$0x1,%eax 14: 8b 80 00 00 00 00 mov0x0(%eax),%eax 1a: 83 ec 0csub$0xc,%esp 1d: 6a 01 push $0x1 1f: ff d0 call *%eax - 21: 83 c4 10add$0x10,%esp + 21: 83 c4 0cadd$0xc,%esp 24: 90 nop 25: c9 leave 26: c3 ret >>> But doesn't in 9.4, 10.0, and 10.1 (seems to be fixed again in 10.2+, presumably per this fix). I mention this only because I finally found this relevant PR, and perhaps knowing it might affect decisions about which branches should get fixed - e.g. 9.x is in stage 4 but this is a 9.3.0->9.4.0 regression (presumably PR090750), and also wrong-code. But we were able to work around it, and so I'm not directly arguing for (or against) a backport to Ubuntu 20.04 compiler **is** affected despite claiming to be 9.3.0 - Ubuntu has seemingly backported the gcc 9 branch through 4ad02cfb768 (git-updates.patch in gcc-9_9.3.0-17ubuntu1~20.04.debian.tar.xz). But I'll raise that separately in their bug tracker.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Jason Merrill changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Jason Merrill --- Testcase fixed.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Rainer Orth changed: What|Removed |Added CC||ro at gcc dot gnu.org Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #6 from Rainer Orth --- The new testcase FAILs on 32-bit Solaris/x86: +FAIL: g++.dg/ext/tmplattr10.C -std=c++98 (test for excess errors) Excess errors: /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:15:31: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:16:28: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:18:11: error: expected nested-name-specifier before 'type' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:21:31: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:22:39: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:24:11: error: expected nested-name-specifier before 'type' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:27:31: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:28:38: error: variadic templates only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:30:11: error: expected nested-name-specifier before 'type' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:34:6: error: ISO C++ forbids declaration of 'wrap' with no type [-fpermissive] /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:34:1: error: top-level declaration of 'wrap' specifies 'auto' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:34:51: error: trailing return type only available with '-std=c++11' or '-std=gnu++11' /vol/gcc/src/hg/master/local/gcc/testsuite/g++.dg/ext/tmplattr10.C:51:12: error: 'wrap' was not declared in this scope
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Jason Merrill --- Fixed for 10.2/11.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 --- Comment #4 from CVS Commits --- The releases/gcc-10 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:0c473d8f32510fcc96d584ee5099b856cfd3d8d6 commit r10-8189-g0c473d8f32510fcc96d584ee5099b856cfd3d8d6 Author: Jason Merrill Date: Mon May 25 19:04:05 2020 -0400 c++: Fix stdcall attribute in template. [PR95222] Another case that breaks with my fix for PR90750: we shouldn't move type attributes in TYPENAME context either, as there's no decl for them to move to. gcc/cp/ChangeLog: PR c++/95222 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME context. gcc/testsuite/ChangeLog: PR c++/95222 * g++.dg/ext/tmplattr10.C: New test. (cherry picked from commit 7e7d9fcff56385812764cba63e1ebf6f4c6c0320)
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 --- Comment #3 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:7e7d9fcff56385812764cba63e1ebf6f4c6c0320 commit r11-662-g7e7d9fcff56385812764cba63e1ebf6f4c6c0320 Author: Jason Merrill Date: Mon May 25 19:04:05 2020 -0400 c++: Fix stdcall attribute in template. [PR95222] Another case that breaks with my fix for PR90750: we shouldn't move type attributes in TYPENAME context either, as there's no decl for them to move to. gcc/cp/ChangeLog: PR c++/95222 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME context. gcc/testsuite/ChangeLog: PR c++/95222 * g++.dg/ext/tmplattr10.C: New test.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Keywords|needs-bisection | Last reconfirmed||2020-05-23 Ever confirmed|0 |1 CC||jakub at gcc dot gnu.org, ||jason at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Rejected since r10-7998-g5f1cd1da1a805c3d00332da45c3ab78a3931af63 , on Linux needs -m32.
[Bug c++/95222] [10/11 Regression] GCC 10.1 x86 issue with function pointers with calling convention attribute and template specialization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95222 Richard Biener changed: What|Removed |Added Summary|GCC 10.1 x86 issue with |[10/11 Regression] GCC 10.1 |function pointers with |x86 issue with function |calling convention |pointers with calling |attribute and template |convention attribute and |specialization |template specialization Target Milestone|--- |10.2 Target||x86_64-*-* i?86-*-* Keywords||needs-bisection, ||rejects-valid