Bug 1958715 - devtoolset-8-gcc memset returns spurious offset
Summary: devtoolset-8-gcc memset returns spurious offset
Keywords:
Status: NEW
Alias: None
Product: softwarecollections.org
Classification: Community
Component: Other
Version: 1.0
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Adam Samalik
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-10 00:46 UTC by Craig Thomas
Modified: 2021-05-10 00:46 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)
Code to repro bug (385 bytes, text/plain)
2021-05-10 00:46 UTC, Craig Thomas
no flags Details

Description Craig Thomas 2021-05-10 00:46:35 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.