https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121661
Bug ID: 121661 Summary: miscompilation involving complex and nested functions Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: uecker at gcc dot gnu.org Target Milestone: --- The following example is miscompiled to output zero instead of 1. Strangle in seems to depend on the presence of a nested function and the address-of. https://godbolt.org/z/M979PM88a #include <assert.h> #include <stdio.h> #include <complex.h> static void fun1(complex double val) { #if 1 void nfun() { printf("%f\n", creal(val)); } (void)nfun; (void)&val; printf("%f\n", creal(val)); } int main(int argc, char* []) { fun1(1.); }