public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96631] New: Incorrect optimization of memcmp with zero-filled buffer
@ 2020-08-16 20:11 blashyrkh at inbox dot ru
  2020-08-16 20:26 ` [Bug middle-end/96631] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: blashyrkh at inbox dot ru @ 2020-08-16 20:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96631

            Bug ID: 96631
           Summary: Incorrect optimization of memcmp with zero-filled
                    buffer
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blashyrkh at inbox dot ru
  Target Milestone: ---

Created attachment 49067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49067&action=edit
Preprocessed source

memcmp of static const buffer filled with zeroes and non-const buffer starting
with zero (other bytes are non-zeroes) returns 0 if compiled with -O2 or -O3.

Compiler command line: gcc -v --save-temps -O2 memcmptest.c

Compiler output:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-9.3.0-r1/work/gcc-9.3.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.3.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 9.3.0-r1 p3' --disable-esp --enable-libstdcxx-time
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64
--disable-fixed-point --enable-targets=all --enable-libgomp
--disable-libmudflap --disable-libssp --disable-libada --disable-systemtap
--enable-vtable-verify --enable-lto --without-isl --enable-default-pie
--enable-default-ssp
Thread model: posix
gcc version 9.3.0 (Gentoo 9.3.0-r1 p3) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/cc1 -E -quiet -v memcmptest.c
-mtune=generic -march=x86-64 -O2 -fpch-preprocess -o memcmptest.i
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/cc1 -fpreprocessed memcmptest.i
-quiet -dumpbase memcmptest.c -mtune=generic -march=x86-64 -auxbase memcmptest
-O2 -version -o memcmptest.s
GNU C17 (Gentoo 9.3.0-r1 p3) version 9.3.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2,
MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C17 (Gentoo 9.3.0-r1 p3) version 9.3.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2,
MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b5264bf09fb15fef9b8caba6bb13d5fc
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/as
-v --64 -o memcmptest.o memcmptest.s
GNU assembler version 2.33.1 (x86_64-pc-linux-gnu) using BFD version (Gentoo
2.33.1 p2) 2.33.1
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/collect2 -plugin
/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
-plugin-opt=-fresolution=memcmptest.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0
-L/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64
-L/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../.. memcmptest.o -lgcc
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed
-lgcc_s --pop-state /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64'

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/96631] Incorrect optimization of memcmp with zero-filled buffer
  2020-08-16 20:11 [Bug c/96631] New: Incorrect optimization of memcmp with zero-filled buffer blashyrkh at inbox dot ru
@ 2020-08-16 20:26 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-08-16 20:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96631

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 95189.

*** This bug has been marked as a duplicate of bug 95189 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-16 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 20:11 [Bug c/96631] New: Incorrect optimization of memcmp with zero-filled buffer blashyrkh at inbox dot ru
2020-08-16 20:26 ` [Bug middle-end/96631] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).