https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91974
Bug ID: 91974 Summary: function not sequenced before function argument Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- >From StackOverflow (https://stackoverflow.com/q/58204296/2069064), reduced: extern void call(int); void a(int) { call(0); } void b(int) { call(1); } int main() { using T = void(*)(int); T f = a; f((f=b,0)); } This is a well-defined (if weird) program that should a - that is call(0). With gcc, it invokes call(1) (that is, the assignment that happens in the initialization of the function parameter happens before the load of the function itself). On -O2, the codegen is: main: sub rsp, 8 mov edi, 1 call call(int) xor eax, eax add rsp, 8 ret