This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix debug info for modified parameter
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 11 Nov 2013 14:06:38 +0100
- Subject: Re: [patch] Fix debug info for modified parameter
- Authentication-results: sourceware.org; auth=none
- References: <4469508 dot vHvxoD4oqs at polaris>
On Mon, Nov 11, 2013 at 11:56 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> since the switch to SSA form at -O0, the compiler generates wrong debug info
> for something like:
>
> void
> foo (int i)
> {
> int j = 0;
> i = 1;
> j = j + 1; /* BREAK */
> }
>
> If you try to display the value of i after breaking in GDB, you don't get 1.
> The reason is that there is no default def SSA_NAME for i in this case, so no
> partitions get the RTL location of the parameter.
>
> Tentative patch attached, it's admittedly a little heavy, but I don't see any
> other solution. Tested on x86_64-suse-linux, OK for the mainline?
Hmm, at -O0 we should be able to coalesce all SSA names of a
DECL. So in theory the following should work:
Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c (revision 204664)
+++ gcc/cfgexpand.c (working copy)
@@ -1619,7 +1619,7 @@ expand_used_vars (void)
we don't do anything here. But those which don't contain the
default def (representing a temporary based on the parm/result)
we need to allocate space just like for normal VAR_DECLs. */
- if (!bitmap_bit_p (SA.partition_has_default_def, i))
+ if (optimize && !bitmap_bit_p (SA.partition_has_default_def, i))
{
expand_one_var (var, true, true);
gcc_assert (SA.partition_to_pseudo[i]);
eventually restricting handling to !DECL_IGNORED_P / !DECL_ARTIFICIAL
variables.
Richard.
>
> 2013-11-11 Eric Botcazou <ebotcazou@adacore.com>
>
> * tree-outof-ssa.c (remove_ssa_form): For a parameter without default
> def, pretend that the single partition that contains all the SSA_NAMEs
> for this parameter, if it exists, also contains the default def.
>
>
> 2013-11-11 Eric Botcazou <ebotcazou@adacore.com>
>
> * gcc.dg/guality/param-4.c: New test.
>
>
> --
> Eric Botcazou