public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: George Thomas <georgethomas.mec@gmail.com>
To: Andrew Pinski <pinskia@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [RFC, middlend] Fix for PR54218
Date: Fri, 11 Jan 2013 17:37:00 -0000	[thread overview]
Message-ID: <CAKJOuMoQnO14jKhPobQM1iw=89R2h_ggVQXEEYLCU=RJBtjSMg@mail.gmail.com> (raw)
In-Reply-To: <CA+=Sn1mBjo2kDw7HVDCiRQqQ9--qxjAJR7aKvtgSa8mBLP9nuA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

On Fri, Jan 11, 2013 at 9:53 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Fri, Jan 11, 2013 at 8:17 AM, George Thomas
> <georgethomas.mec@gmail.com> wrote:
>> Hi,
>>
>> I am sending a patch which solves the debugging issue (PR 54218).
>>
>> The fix is to allocate stack space only once for parameters in expand pass.
>>
>> The patch is attached. Could someone suggest if its right ?
>
> I have just a formatting issue:
> +         if (TREE_CODE (SSA_NAME_VAR (var)) != PARM_DECL)
> +          {
> +            if (!bitmap_bit_p (SA.partition_has_default_def, i))
>
> I think it would have been better if you had done instead:
>           if (TREE_CODE (SSA_NAME_VAR (var)) != PARM_DECL
>              && !bitmap_bit_p (SA.partition_has_default_def, i))
>

I have attached the updated patch with the changes suggested.
Also adding a dejagnu test case to reproduce the bug.

> So there are no other white space changes.
>
> Also missing a changelog entry too.
>

I am adding the change logs below.

2013-01-11  George Thomas  <george.thomas@atmel.com>
                     Senthil Kumar Selvaraj <Senthil_Kumar.Selvaraj@atmel.com>

         PR middle-end/54218

         * gcc/cfgexpand.c (expand_used_vars ) :Added
                  a step to not allocate stack space if its a parameter

         * gcc.dg/pr54218.c : New test


Hoping that the changes are fine for trunk.

Thanks,
George

[-- Attachment #2: PR54218.patch --]
[-- Type: application/octet-stream, Size: 1429 bytes --]

diff -Naurp gcc/cfgexpand.c gcc/cfgexpand.c
--- gcc/cfgexpand.c	2013-01-11 16:40:46.000000000 +0530
+++ gcc/cfgexpand.c	2013-01-11 22:57:48.000000000 +0530
@@ -1568,11 +1568,12 @@ 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))
-	    {
-	      expand_one_var (var, true, true);
-	      gcc_assert (SA.partition_to_pseudo[i]);
-	    }
+         if (TREE_CODE (SSA_NAME_VAR (var)) != PARM_DECL
+          && !bitmap_bit_p (SA.partition_has_default_def, i))
+           {
+             expand_one_var (var, true, true);
+             gcc_assert (SA.partition_to_pseudo[i]);
+           }
 	}
     }
   pointer_map_destroy (ssa_name_decls);
diff -Naurp gcc/testsuite/gcc.dg/pr54218.c gcc/testsuite/gcc.dg/pr54218.c
--- gcc/testsuite/gcc.dg/pr54218.c	1970-01-01 05:30:00.000000000 +0530
+++ gcc/testsuite/gcc.dg/pr54218.c	2013-01-11 22:39:07.000000000 +0530
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-g -fvar-tracking" } */
+/* { dg-skip-if "" { *-*-* }  { "*" } { "-O0" } } */
+
+void func(int p)
+{
+    p = 0; /* { dg-final { gdb-test 8 "p" "0" } } */
+    p = 32;/* { dg-final { gdb-test 8 "p" "42" } } */
+}
+
+int
+main (void)
+{
+    int local = 42;
+    func(local);
+}

  reply	other threads:[~2013-01-11 17:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11 16:17 George Thomas
2013-01-11 16:23 ` Andrew Pinski
2013-01-11 17:37   ` George Thomas [this message]
2013-01-14 14:42     ` Richard Biener
2013-01-16 18:36       ` George Thomas

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='CAKJOuMoQnO14jKhPobQM1iw=89R2h_ggVQXEEYLCU=RJBtjSMg@mail.gmail.com' \
    --to=georgethomas.mec@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.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).