https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69047
Bug ID: 69047 Summary: memcpy of 64-bit integer to 32-bit integer causes pointless stack operations on ARM Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: x.fix at o2 dot pl Target Milestone: --- Created attachment 37131 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37131&action=edit d.c When a function does memcpy to a local integer and returns it, pointless stack operations are done (subtraction, and addition just after that). Command line ============ arm-none-eabi-gcc -O3 -S -o- d.c Output ====== Assembly code containing following function. f: @ Function supports interworking. @ args = 0, pretend = 0, frame = 8 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. sub sp, sp, #8 add sp, sp, #8 @ sp needed bx lr .size f, .-f Version information =================== Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/5.3.0/lto-wrapper Target: arm-none-eabi Configured with: /build/arm-none-eabi-gcc/src/gcc-5.3.0/configure --target=arm-none-eabi --prefix=/usr --with-sysroot=/usr/arm-none-eabi --with-native-system-header-dir=/include --libexecdir=/usr/lib --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-system-zlib --with-newlib --with-headers=/usr/arm-none-eabi/include --with-python-dir=share/gcc-arm-none-eabi --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='Arch Repository' --with-bugurl=https://bugs.archlinux.org/ --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r Thread model: single gcc version 5.3.0 (Arch Repository)