public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: Re: [PATCH, PR66432] Handle PARM_DECL in remap_gimple_op_r
Date: Wed, 01 Jul 2015 17:10:00 -0000	[thread overview]
Message-ID: <55941EB4.9080402@mentor.com> (raw)
In-Reply-To: <CAFiYyc0uc1jQtNeRv=nvgp102XueT60kmM+aFAs1zv+kJK8H0g@mail.gmail.com>

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

On 01/07/15 13:58, Richard Biener wrote:
> On Wed, Jul 1, 2015 at 1:43 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> Hi,
>>
>> I.
>>
>> When running test libgomp.c/appendix-a/a.29.1.c with '--target_board
>> unix/-O2/-g', we run into this failure:
>> ...
>> FAIL: libgomp.c/appendix-a/a.29.1.c (test for excess errors)
>> Excess errors:
>> src/libgomp/testsuite/libgomp.c/appendix-a/a.29.1.c:6:1: error: type
>> mismatch between an SSA_NAME and its symbol
>> ...
>>
>> Without -g, the testcase passes.
>>
>>
>> II.
>>
>> The scenario for the failure is as follows:
>>
>> At fnsplit, we split off f.part.0 from f, which at source level looks like
>> this:
>> ...
>> void
>> f (int n, int B[n][n], int C[])
>> {
>>    int D[2][2] = { 1, 2, 3, 4 };
>>    int E[n][n];
>>    assert (n >= 2);
>>    E[1][1] = 4;
>> #pragma omp parallel firstprivate(B, C, D, E)
>>    {
>>      assert (sizeof (B) == sizeof (int (*)[n]));
>>      assert (sizeof (C) == sizeof (int *));
>>      assert (sizeof (D) == 4 * sizeof (int));
>>      assert (sizeof (E) == n * n * sizeof (int));
>>      /* Private B and C have values of original B and C. */
>>      assert (&B[1][1] == &A[1][1]);
>>      assert (&C[3] == &A[1][1]);
>>      assert (D[1][1] == 4);
>>      assert (E[1][1] == 4);
>>    }
>> }
>> ...
>>
>> The split introduces a debug_insn and ssa-name that references param B in f:
>> ...
>>    # DEBUG D#4ptD.0 => B_3(D)
>> ..
>>
>> And a debug_insn that references param B in f.part.0:
>> ...
>>    # DEBUG D#7ptD.0 s=> BD.1846
>> ...
>>
>> At this point, the type of the ssa name and the param are the same.
>
> With the same PARM_DECL?  I think that's the bug.
>

Attached patch also fixes the ICE, by copying the PARM_DECL using in the 
debug insn. Does this look ok for testing?

Thanks,
- Tom

[-- Attachment #2: 0001-Copy-PARM_DECL-for-use-in-split-off-function.patch --]
[-- Type: text/x-patch, Size: 1338 bytes --]

Copy PARM_DECL for use in split off function.

2015-06-30  Tom de Vries  <tom@codesourcery.com>

	PR middle-end/66432
	* ipa-split.c (split_function): Copy PARM_DECL for use in split off
	function.

	* testsuite/libgomp.c/pr66432.c: New test.
---
 gcc/ipa-split.c                       | 2 +-
 libgomp/testsuite/libgomp.c/pr66432.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 libgomp/testsuite/libgomp.c/pr66432.c

diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 13d9a64..e923cee 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1458,7 +1458,7 @@ split_function (basic_block return_bb, struct split_point *split_point,
 	  DECL_ARTIFICIAL (ddecl) = 1;
 	  TREE_TYPE (ddecl) = TREE_TYPE (parm);
 	  DECL_MODE (ddecl) = DECL_MODE (parm);
-	  vec_safe_push (*debug_args, DECL_ORIGIN (parm));
+	  vec_safe_push (*debug_args, copy_node (DECL_ORIGIN (parm)));
 	  vec_safe_push (*debug_args, ddecl);
 	  def_temp = gimple_build_debug_bind (ddecl, unshare_expr (arg),
 					      call);
diff --git a/libgomp/testsuite/libgomp.c/pr66432.c b/libgomp/testsuite/libgomp.c/pr66432.c
new file mode 100644
index 0000000..2259a69
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr66432.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-additional-options "-g" } */
+
+#include "appendix-a/a.29.1.c"
-- 
1.9.1


  reply	other threads:[~2015-07-01 17:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 11:44 Tom de Vries
2015-07-01 11:58 ` Richard Biener
2015-07-01 17:10   ` Tom de Vries [this message]
2015-07-02  8:49     ` Richard Biener

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=55941EB4.9080402@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    --cc=richard.guenther@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).