gcc insists on generating a call to memset when setting initial values for a temporary variable of a struct

Da Shi Cao via Gcc-help <[email protected]> Thu, 5 Feb 2026 06:29:41 +0000
Newsgroups gmane.comp.gcc.help
Message-ID <PH7PR10MB65310F79533A7FD995B181678C99A@PH7PR10MB6531.namprd10.prod.outlook.com>
Please see the attached files for details.

The output of my gcc --verbose is as follows:
Using built-in specs.
COLLECT_GCC=arm-elf-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/opt/arm/libexec/gcc/arm-elf-linux-gnueabihf/15.2.0/lto-wrapper
Target: arm-elf-linux-gnueabihf
Configured with: /home/dscao/build/src/gcc.git/configure --prefix=/opt/arm --target=arm-elf-linux-gnueabihf --with-arch=armv7-a --with-tune=cortex-a8 --with-sysroot=/var/armroot/arm --with-gnu-as --with-gnu-ld --disable-multiarch --enable-languages=c,c++ --disable-nls --with-gnu-ld --enable-shared --enable-threads=posix --disable-multilib --disable-libgomp --disable-libada --disable-bootstrap --disable-libitm --with-system-zlib --with-fpu=vfpv3-d16 --with-float=hard
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (GCC)

Regards,
Dashi Cao
mpu_demo.i (application/octet-stream, 56.1 KB) - not displayed
mpu_demo.s (application/octet-stream, 19.5 KB) - not displayed