From: Richard Guenther <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix ICE in expand_debug_expr on CONJ_EXPR (PR debug/41717)
Date: Fri, 16 Oct 2009 09:54:00 -0000 [thread overview]
Message-ID: <84fc9c000910160250l18329df5id2977df295c26e4d@mail.gmail.com> (raw)
In-Reply-To: <20091015232358.GO14664@tyan-ft48-01.lab.bos.redhat.com>
On Fri, Oct 16, 2009 at 1:23 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> CONJ_EXPR wasn't handled by expand_debug_expr, this patch handles at least
> the easy cases.
>
> Also, I've noticed that through a SUBREG with outer mode MODE_INT and inner
> mode e.g. floating mem_loc_descriptor could try to represent e.g. floating
> point multiplication via DW_OP_mul (integer operation) etc. And, the code
> is prepared to handle only lowpart subregs, not arbitrary ones.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2009-10-15 Jakub Jelinek <jakub@redhat.com>
>
> PR debug/41717
> * cfgexpand.c (expand_debug_expr): Handle CONJ_EXPR.
> * dwarf2out.c (mem_loc_descriptor): Don't handle
> POST_INT/POST_DEC/POST_MODIFY like SUBREG. For SUBREG
> punt if it is not lowpart subreg or if inner mode isn't
> MODE_INT.
>
> * gcc.dg/debug/pr41717.c: New test.
>
> --- gcc/cfgexpand.c.jj 2009-10-15 22:07:43.000000000 +0200
> +++ gcc/cfgexpand.c 2009-10-15 23:14:21.000000000 +0200
> @@ -2869,6 +2869,21 @@ expand_debug_expr (tree exp)
> op1 = gen_rtx_CONST (GET_MODE_INNER (mode), op1);
> return gen_rtx_CONCAT (mode, op0, op1);
>
> + case CONJ_EXPR:
> + if (GET_CODE (op0) == CONCAT)
> + return gen_rtx_CONCAT (mode, XEXP (op0, 0),
> + gen_rtx_NEG (GET_MODE_INNER (mode),
> + XEXP (op0, 1)));
> + if (MEM_P (op0))
> + {
> + enum machine_mode imode = GET_MODE_INNER (mode);
> + rtx re = adjust_address_nv (op0, imode, 0);
> + rtx im = adjust_address_nv (op0, imode, GET_MODE_SIZE (imode));
> + im = gen_rtx_NEG (imode, im);
> + return gen_rtx_CONCAT (mode, re, im);
> + }
> + return NULL;
> +
> case ADDR_EXPR:
> op0 = expand_debug_expr (TREE_OPERAND (exp, 0));
> if (!op0 || !MEM_P (op0))
> --- gcc/dwarf2out.c.jj 2009-10-15 22:07:43.000000000 +0200
> +++ gcc/dwarf2out.c 2009-10-15 23:14:21.000000000 +0200
> @@ -12894,10 +12894,7 @@ mem_loc_descriptor (rtx rtl, enum machin
> case POST_INC:
> case POST_DEC:
> case POST_MODIFY:
> - /* POST_INC and POST_DEC can be handled just like a SUBREG. So we
> - just fall into the SUBREG code. */
> -
> - /* ... fall through ... */
> + return mem_loc_descriptor (XEXP (rtl, 0), mode, initialized);
>
> case SUBREG:
> /* The case of a subreg may arise when we have a local (register)
> @@ -12905,9 +12902,13 @@ mem_loc_descriptor (rtx rtl, enum machin
> up an entire register. For now, just assume that it is
> legitimate to make the Dwarf info refer to the whole register which
> contains the given subreg. */
> - rtl = XEXP (rtl, 0);
> + if (!subreg_lowpart_p (rtl))
> + break;
> + rtl = SUBREG_REG (rtl);
> if (GET_MODE_SIZE (GET_MODE (rtl)) > DWARF2_ADDR_SIZE)
> break;
> + if (GET_MODE_CLASS (GET_MODE (rtl)) != MODE_INT)
> + break;
> mem_loc_result = mem_loc_descriptor (rtl, mode, initialized);
> break;
>
> --- gcc/testsuite/gcc.dg/debug/pr41717.c.jj 2009-10-15 23:13:24.000000000 +0200
> +++ gcc/testsuite/gcc.dg/debug/pr41717.c 2009-10-15 23:12:52.000000000 +0200
> @@ -0,0 +1,10 @@
> +/* PR debug/41717 */
> +/* { dg-do compile } */
> +
> +void
> +foo (void)
> +{
> + _Complex float v[1], w;
> + v[1] = 0.0f + 0.8fi;
> + w = __builtin_conjf (v[1] * v[1]);
> +}
>
> Jakub
>
prev parent reply other threads:[~2009-10-16 9:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 23:30 Jakub Jelinek
2009-10-16 8:48 ` [PATCH] Fix ICE in expand_debug_expr on CONJ_EXPR (PR debug/41717, take 2) Jakub Jelinek
2009-10-16 10:06 ` Richard Guenther
2009-10-16 9:54 ` Richard Guenther [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84fc9c000910160250l18329df5id2977df295c26e4d@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).