Fix PR tree-optimization/96670 - ICE on memchr with an empty initializer.
authorMartin Sebor <msebor@redhat.com>
Tue, 18 Aug 2020 18:49:35 +0000 (12:49 -0600)
committerMartin Sebor <msebor@redhat.com>
Tue, 18 Aug 2020 18:49:35 +0000 (12:49 -0600)
commitbb04901d14f7749eb949092fd3dfcb6ca1958701
tree9196064b99a008ace33b45f80d9cdad1aba5ff2d
parent16bea83ae55fdbb4d1e79f27c991c2b682813755
Fix PR tree-optimization/96670 - ICE on memchr with an empty initializer.

gcc/ChangeLog:

PR tree-optimization/96670
PR middle-end/78257
* gimple-fold.c (gimple_fold_builtin_memchr): Call byte_representation
to get it, not string_constant.

gcc/testsuite/ChangeLog:

PR tree-optimization/96670
* gcc.dg/memchr-2.c: New test.
* gcc.dg/memcmp-6.c: New test.
gcc/gimple-fold.c
gcc/testsuite/gcc.dg/memchr-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/memcmp-6.c [new file with mode: 0644]