Fedora Account System
Red Hat Associate
Red Hat Customer
Created attachment 1781463 [details] Code to repro bug Description of problem: memset is supposed to return the same address as that passed in, but the optimizer sometimes adds a spurious offset. Version-Release number of selected component (if applicable): $ yum info devtoolset-8 Installed Packages Name : devtoolset-8 Arch : x86_64 Version : 8.1 Release : 1.el7 $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr --mandir=/opt/rh/devtoolset-8/root/usr/share/man --infodir=/opt/rh/devtoolset-8/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-8.3.1-20190311/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC) $ cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) How reproducible: Given code that provokes the problem, reproducible every time. Steps to Reproduce: 1. Enable the toolset scl enable devtoolset-8 bash 2. Build the attached c source with the following command gcc -O memset_test.c 3. Execute the output ./a.out Actual results: The address returned by memset should equal the address passed in, but is instead offset. The following is printed to stdout (addresses may vary): FAIL: 0x7ffda92595b0 != 0x7ffda92595b2 Expected results: The addresses should be equal. The binary should print: Success Additional info: Compiled with no optimizations, yields the expected result. Change some code near to the memset and the offset may be different. eg including the line: sin.sin_port = htons(123); causes a larger offset to be returned from memset.