diff mbox

Avoid setting first GIMPLE_DEBUG operand to MEM_REF in lto streaming (PR lto/46879)

Message ID 20101210194949.GT29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 10, 2010, 7:49 p.m. UTC
Hi!

The first operand of GIMPLE_DEBUG must be a DECL, not a MEM_REF, so the
DECL -> MEM_REF replacement output_gimple_stmt does is wrong for it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2010-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR lto/46879
	* lto-streamer-out.c (output_gimple_stmt): Never replace first
	GIMPLE_DEBUG argument with MEM_REF.


	Jakub

Comments

Richard Biener Dec. 13, 2010, 4:35 p.m. UTC | #1
On Fri, Dec 10, 2010 at 8:49 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The first operand of GIMPLE_DEBUG must be a DECL, not a MEM_REF, so the
> DECL -> MEM_REF replacement output_gimple_stmt does is wrong for it.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

Ok.

Thanks,
Richard.

> 2010-12-10  Jakub Jelinek  <jakub@redhat.com>
>
>        PR lto/46879
>        * lto-streamer-out.c (output_gimple_stmt): Never replace first
>        GIMPLE_DEBUG argument with MEM_REF.
>
> --- gcc/lto-streamer-out.c.jj   2010-12-02 11:51:31.000000000 +0100
> +++ gcc/lto-streamer-out.c      2010-12-10 17:13:32.000000000 +0100
> @@ -1759,8 +1759,9 @@ output_gimple_stmt (struct output_block
>          tree op = gimple_op (stmt, i);
>          /* Wrap all uses of non-automatic variables inside MEM_REFs
>             so that we do not have to deal with type mismatches on
> -            merged symbols during IL read in.  */
> -         if (op)
> +            merged symbols during IL read in.  The first operand
> +            of GIMPLE_DEBUG must be a decl, not MEM_REF, though.  */
> +         if (op && (i || !is_gimple_debug (stmt)))
>            {
>              tree *basep = &op;
>              while (handled_component_p (*basep))
>
>        Jakub
>
diff mbox

Patch

--- gcc/lto-streamer-out.c.jj	2010-12-02 11:51:31.000000000 +0100
+++ gcc/lto-streamer-out.c	2010-12-10 17:13:32.000000000 +0100
@@ -1759,8 +1759,9 @@  output_gimple_stmt (struct output_block 
 	  tree op = gimple_op (stmt, i);
 	  /* Wrap all uses of non-automatic variables inside MEM_REFs
 	     so that we do not have to deal with type mismatches on
-	     merged symbols during IL read in.  */
-	  if (op)
+	     merged symbols during IL read in.  The first operand
+	     of GIMPLE_DEBUG must be a decl, not MEM_REF, though.  */
+	  if (op && (i || !is_gimple_debug (stmt)))
 	    {
 	      tree *basep = &op;
 	      while (handled_component_p (*basep))