diff options
author | Martin Sebor <msebor@redhat.com> | 2020-08-18 12:49:35 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-08-18 12:49:35 -0600 |
commit | bb04901d14f7749eb949092fd3dfcb6ca1958701 (patch) | |
tree | 9196064b99a008ace33b45f80d9cdad1aba5ff2d /gcc/gimple-fold.c | |
parent | 16bea83ae55fdbb4d1e79f27c991c2b682813755 (diff) | |
download | gcc-bb04901d14f7749eb949092fd3dfcb6ca1958701.zip gcc-bb04901d14f7749eb949092fd3dfcb6ca1958701.tar.gz gcc-bb04901d14f7749eb949092fd3dfcb6ca1958701.tar.bz2 |
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.
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index db56cb6..dcc1b56 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -2670,7 +2670,7 @@ gimple_fold_builtin_memchr (gimple_stmt_iterator *gsi) if (r == NULL) { tree mem_size, offset_node; - string_constant (arg1, &offset_node, &mem_size, NULL); + byte_representation (arg1, &offset_node, &mem_size, NULL); unsigned HOST_WIDE_INT offset = (offset_node == NULL_TREE) ? 0 : tree_to_uhwi (offset_node); /* MEM_SIZE is the size of the array the string literal |