]> gcc.gnu.org Git - gcc.git/commit
print-rtl: Fix printing of CONST_STRING in DEBUG_INSNs [PR93399]
authorJakub Jelinek <jakub@redhat.com>
Thu, 5 Mar 2020 08:12:44 +0000 (09:12 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 17 Sep 2020 14:20:24 +0000 (16:20 +0200)
commitc035257d1f775f44359fe55ceb3d018a68d87114
treeaec0dd74308e8189d6951fa8a13bd476c40652f6
parent777fa0a232a6bfc7ed3827f35322ec740fe714e9
print-rtl: Fix printing of CONST_STRING in DEBUG_INSNs [PR93399]

The following testcase fails to assemble, as CONST_STRING in the DEBUG_INSNs
is printed as is, so if it contains \n and/or \r, we are in trouble:
        .loc 1 14 3
        # DEBUG haystack => [si]
        # DEBUG needle => "
"
In the gimple dumps we print those (STRING_CSTs) as
  # DEBUG haystack => D#1
  # DEBUG needle => "\n"
so this patch uses what we use in tree printing for the CONST_STRINGs too.

2020-03-05  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/93399
* tree-pretty-print.h (pretty_print_string): Declare.
* tree-pretty-print.c (pretty_print_string): Remove forward
declaration, no longer static.  Change nbytes parameter type
from unsigned to size_t.
* print-rtl.c (print_value) <case CONST_STRING>: Use
pretty_print_string and for shrink way too long strings.

* gcc.dg/pr93399.c: New test.

(cherry picked from commit e0d6777cda966b04fc47d544c09839c4fa94343c)
gcc/print-rtl.c
gcc/testsuite/gcc.dg/pr93399.c [new file with mode: 0644]
gcc/tree-pretty-print.c
gcc/tree-pretty-print.h
This page took 0.066472 seconds and 6 git commands to generate.