https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115891
Bug ID: 115891 Summary: [15 regression] libgcrypt tests segfault in crc32_less_than_16 with LTO Product: gcc Version: unknown Status: UNCONFIRMED Keywords: lto, wrong-code Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org Target Milestone: --- To reproduce: ``` tar xvf libgcrypt-1.11.0.tar.xz && cd libgcrypt-1.11.0 ./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu CC="gcc -m32" CFLAGS="-O2 -ggdb3 -flto" && make -j$(nproc) && make -j$(nproc) check TESTS=basic ``` ``` $ ~/bugs/libgcrypt/libgcrypt-1.11.0/tests $ gdb --args ./basic [...] Program received signal SIGSEGV, Segmentation fault. 0xf7f1644f in crc32_less_than_16 (pcrc=0x592a305c, inbuf=0x56577098 "23456789", inlen=4, consts=0xf7f8a3d0 <crc24rfc2440_consts>) at ../cipher/crc-intel-pclmul.c:781 781 asm volatile (/* store CRC in input endian */ (gdb) bt #0 0xf7f1644f in crc32_less_than_16 (pcrc=0x592a305c, inbuf=0x56577098 "23456789", inlen=4, consts=0xf7f8a3d0 <crc24rfc2440_consts>) at ../cipher/crc-intel-pclmul.c:781 #1 _gcry_crc24rfc2440_intel_pclmul (pcrc=0x592a305c, inbuf=0x56577098 "23456789", inlen=4) at ../cipher/crc-intel-pclmul.c:923 #2 _gcry_crc24rfc2440_intel_pclmul (pcrc=0x592a305c, inbuf=0x56577098 "23456789", inlen=4) at ../cipher/crc-intel-pclmul.c:901 #3 crc24rfc2440_write (context=0x592a305c, inbuf_arg=0x56577098, inlen=4) at ../cipher/crc.c:870 #4 0xf7ebc64e in md_write (a=a@entry=0x5928d520, inbuf=0x56577098, inlen=4) at ../cipher/md.c:778 #5 0xf7ebf4a3 in _gcry_md_hash_buffers_extract (algo=304, flags=<optimized out>, digest=0xffffc7cc, digestlen=3, iov=0xffffc78c, iovcnt=2) at ../cipher/md.c:1368 #6 0xf7ea34f3 in _gcry_md_hash_buffers_extract (algo=304, flags=0, digest=0xffffc7cc, digestlen=-1, iov=0xffffc77c, iovcnt=3) at ../cipher/md.c:1316 #7 _gcry_md_hash_buffers (algo=304, flags=0, digest=0xffffc7cc, iov=0xffffc77c, iovcnt=3) at ../cipher/md.c:1399 #8 gcry_md_hash_buffers (algo=304, flags=0, digest=0xffffc7cc, iov=0xffffc77c, iovcnt=3) at /home/sam/bugs/libgcrypt/libgcrypt-1.11.0/src/visibility.c:1296 #9 0x5656f40a in check_one_md_multi (algo=304, data=<optimized out>, len=<optimized out>, expect=0x565770db "!\317\002", elen=0, n=0x0, s=0x0) at /home/sam/bugs/libgcrypt/libgcrypt-1.11.0/tests/basic.c:14023 #10 0x5656fa04 in check_digests () at /home/sam/bugs/libgcrypt/libgcrypt-1.11.0/tests/basic.c:15524 #11 0x565608f4 in main (argc=<optimized out>, argv=<optimized out>) at /home/sam/bugs/libgcrypt/libgcrypt-1.11.0/tests/basic.c:18315 (gdb) ``` I'll do the usual to narrow it down now but if the issue is in the inline asm, I'll need someone to take a look. Thanks.