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

            Bug ID: 82190
           Summary: Possibly latent miscompilation issue on
                    ppc64le-linux-gnu for memcpy-bi.c with -fweb
                    -fno-optimize-strlen
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

Created attachment 42159
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42159&action=edit
Reduced from memcpy-bi.c

Hi,
I am working on type-promotion patch
(https://gcc.gnu.org/ml/gcc/2017-09/msg00024.html), which miscompiles
memcpy-bi.c on ppc64le-linux-gnu.
After some investigation it seems this is possibly a latent issue on the
target.

It can be reproduced for the attached test-case on pristine trunk (tested with
r250395) with following options: -fno-optimize-strlen -fweb 

The issue seems to be that strlen pass transforms
__builtin_memcmp (dst, src, n) != 0
to __builtin_memcmp_eq(dst, src, n) != 0.
Inhibiting the above transform by disabling strlen pass, somehow interferes
with web pass, which ends up calling abort() while executing
the test-case.

$ ../bootstrap-build/gcc/xgcc -B ../bootstrap-build/gcc -O2
-fno-optimize-strlen -fweb foo.c
$ ./a.out 
Aborted

The test-case is compiled correctly if strlen pass is enabled with web
pass.

Thanks,
Prathamesh

Reply via email to