https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116885
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
CC| |tkoenig at gcc dot gnu.org
Last reconfirmed| |2024-09-29
Ever confirmed|0 |1
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I checked your program with current trunk and with the Ubuntu-supplied
gcc 11.4.0, plus clang 14.0 - they all segfault. With current
trunk, valgrind says
<<<struct>>> (c)1998-2024 Jaroslav Fojtik
This program tests the struct.c library
***LO_ENDIAN defined***
***NATIVE access***
Testing struct manipulation
==690483== Invalid read of size 1
==690483== at 0x48534F0: mempcpy (in
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==690483== by 0x49E9664: _IO_new_file_xsputn (fileops.c:1235)
==690483== by 0x49E9664: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196)
==690483== by 0x49DDFD6: fwrite (iofwrite.c:39)
==690483== by 0x402051: savestruct (struct.c:484)
==690483== by 0x40227B: SaveTopolHeader (mintest.c:50)
==690483== by 0x401277: main (mintest.c:143)
==690483== Address 0x654d2074726f6853 is not stack'd, malloc'd or (recently)
free'd
==690483==
==690483==
==690483== Process terminating with default action of signal 11 (SIGSEGV)
==690483== General Protection Fault
==690483== at 0x48534F0: mempcpy (in
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==690483== by 0x49E9664: _IO_new_file_xsputn (fileops.c:1235)
==690483== by 0x49E9664: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196)
==690483== by 0x49DDFD6: fwrite (iofwrite.c:39)
==690483== by 0x402051: savestruct (struct.c:484)
==690483== by 0x40227B: SaveTopolHeader (mintest.c:50)
==690483== by 0x401277: main (mintest.c:143)
I suspect there is an error in your reduced test case.