c-family: Fix up MEM_REF printing [PR95580]
authorJakub Jelinek <jakub@redhat.com>
Tue, 9 Jun 2020 06:39:36 +0000 (08:39 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 9 Jun 2020 06:39:36 +0000 (08:39 +0200)
commitd6dbb71e468d0db561cc9eca99eeaca1efb81c11
tree2293a295ea3c2d2985db643e2eecf968927de0ba
parent653ab081391e9e7e38b304f3234323c93693d40c
c-family: Fix up MEM_REF printing [PR95580]

The C FE in the MEM_REF printing ICEs if the type of the first argument
(which due to useless pointer conversions can be an arbitrary type) is a
pointer to an incomplete type.  The code just wants to avoid printing a cast
if it is a pointer to single byte elements.

2020-06-09  Jakub Jelinek  <jakub@redhat.com>

PR c/95580
* c-pretty-print.c (c_pretty_printer::unary_expression): Handle the
case when MEM_REF's first argument has type pointer to incomplete type.

* gcc.dg/pr95580.c: New test.
gcc/c-family/c-pretty-print.c
gcc/testsuite/gcc.dg/pr95580.c [new file with mode: 0644]