diff mbox

Fix debug info for modified parameter

Message ID CAFiYyc2TE4bMcxVLFsRLjrpUmNazo=Up-wEG4BpXY2CkFKnfkw@mail.gmail.com
State New
Headers show

Commit Message

Richard Biener Nov. 11, 2013, 1:06 p.m. UTC
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:


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
diff mbox

Patch

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]);