This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/85045, ICE when printing RDIV_EXPR
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 23 Mar 2018 14:18:53 +0100
- Subject: Re: C++ PATCH for c++/85045, ICE when printing RDIV_EXPR
- References: <20180323104900.GN3522@redhat.com> <20180323105904.GF8577@tucnak> <20180323131632.GO3522@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Mar 23, 2018 at 02:16:32PM +0100, Marek Polacek wrote:
> > So, I think you want:
> > 1) in cxx_pretty_printer::multiplicative_expression add
> > EXACT_DIV_EXPR and (like you did) RDIV_EXPR, and change the pp_slash
> > condition to code != TRUNC_MOD_EXPR
> > 2) in cxx_pretty_printer::expression above the multiplicative_expression
> > call add case EXACT_DIV_EXPR: and case RDIV_EXPR
> > 3) in c_pretty_printer::multiplicative_expression change the
> > code == TRUNC_DIV_EXPR condition to code != TRUNC_MOD_EXPR.
>
> Done.
>
> > 4) see if you can reproduce the c-pretty-print.c bug in some C testcase,
> > whether you get really % instead of / printed for floating point division.
>
> I've found one, though it's quite bizzare. But it showed that we were printing
> "a % b" despite the user code having "a / b".
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2018-03-23 Marek Polacek <polacek@redhat.com>
>
> PR c++/85045
> * c-pretty-print.c (c_pretty_printer::multiplicative_expression)
> <case RDIV_EXPR>: Tweak condition.
>
> * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
> Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
> (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
>
> * g++.dg/cpp0x/Wnarrowing5.C: New test.
> * gcc.dg/pr85045.c: New test.
Ok, thanks.
Jakub