https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67413
Bug ID: 67413 Summary: Complex NOP expanded to several operations Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- _Complex unsigned f(_Complex int i){return i;} yields movl %edi, %eax shrq $32, %rdi salq $32, %rdi orq %rdi, %rax ret I read somewhere that complex integers are a deprecated gcc extension, but gcc only warns in pedantic mode, and it should not be too hard to improve the generated code. Note that tree optimizers currently also fail to optimize the corresponding code: long f(long x){ long y = x >> 32; y <<= 32; int z = x; return z | y; } (using & CST instead of >> and << does not help)