Patchwork Fix up ICE in rtl_decl_for_init (PR debug/45500)

login
register
mail settings
Submitter Jakub Jelinek
Date Sept. 2, 2010, 9:45 p.m.
Message ID <20100902214518.GX1269@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/63561/
State New
Headers show

Comments

Jakub Jelinek - Sept. 2, 2010, 9:45 p.m.
Hi!

TYPE_MODE of a generic vector isn't necessarily BLKmode, it can be
some integer mode too (vector_type_mode
      /* For integers, try mapping it to a same-sized scalar mode.  */
hunk), but expand_expr handles VECTOR_CST with non-VECTOR_MODE_P
mode always the same, but forcing the initializer into memory, which
rtl_for_decl_init obviously doesn't want and asserts it doesn't happen.

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

2010-09-02  Jakub Jelinek  <jakub@redhat.com>

	PR debug/45500
	* dwarf2out.c (rtl_for_decl_init): Give up for all generic vectors,
	not just generic vectors with BLKmode.

	* gcc.target/i386/pr45500.c: New test.


	Jakub
Richard Guenther - Sept. 3, 2010, 9:07 a.m.
On Thu, Sep 2, 2010 at 11:45 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> TYPE_MODE of a generic vector isn't necessarily BLKmode, it can be
> some integer mode too (vector_type_mode
>      /* For integers, try mapping it to a same-sized scalar mode.  */
> hunk), but expand_expr handles VECTOR_CST with non-VECTOR_MODE_P
> mode always the same, but forcing the initializer into memory, which
> rtl_for_decl_init obviously doesn't want and asserts it doesn't happen.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk/4.5?

Ok.

Thanks,
Richard.

> 2010-09-02  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/45500
>        * dwarf2out.c (rtl_for_decl_init): Give up for all generic vectors,
>        not just generic vectors with BLKmode.
>
>        * gcc.target/i386/pr45500.c: New test.
>
> --- gcc/dwarf2out.c.jj  2010-08-31 15:39:16.000000000 +0200
> +++ gcc/dwarf2out.c     2010-09-02 19:20:15.213521284 +0200
> @@ -16256,7 +16256,8 @@ rtl_for_decl_init (tree init, tree type)
>     ;
>   /* Vectors only work if their mode is supported by the target.
>      FIXME: generic vectors ought to work too.  */
> -  else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_MODE (type) == BLKmode)
> +  else if (TREE_CODE (type) == VECTOR_TYPE
> +          && !VECTOR_MODE_P (TYPE_MODE (type)))
>     ;
>   /* If the initializer is something that we know will expand into an
>      immediate RTL constant, expand it now.  We must be careful not to
> --- gcc/testsuite/gcc.target/i386/pr45500.c.jj  2010-09-02 19:14:47.746364347 +0200
> +++ gcc/testsuite/gcc.target/i386/pr45500.c     2010-09-02 19:14:06.000000000 +0200
> @@ -0,0 +1,6 @@
> +/* PR debug/45500 */
> +/* { dg-do compile } */
> +/* { dg-options "-g -msse" } */
> +
> +typedef char V __attribute__ ((__vector_size__ (16)));
> +static const V s = { '\n', '\r', '?', '\\' };
>
>        Jakub
>

Patch

--- gcc/dwarf2out.c.jj	2010-08-31 15:39:16.000000000 +0200
+++ gcc/dwarf2out.c	2010-09-02 19:20:15.213521284 +0200
@@ -16256,7 +16256,8 @@  rtl_for_decl_init (tree init, tree type)
     ;
   /* Vectors only work if their mode is supported by the target.
      FIXME: generic vectors ought to work too.  */
-  else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_MODE (type) == BLKmode)
+  else if (TREE_CODE (type) == VECTOR_TYPE
+	   && !VECTOR_MODE_P (TYPE_MODE (type)))
     ;
   /* If the initializer is something that we know will expand into an
      immediate RTL constant, expand it now.  We must be careful not to
--- gcc/testsuite/gcc.target/i386/pr45500.c.jj	2010-09-02 19:14:47.746364347 +0200
+++ gcc/testsuite/gcc.target/i386/pr45500.c	2010-09-02 19:14:06.000000000 +0200
@@ -0,0 +1,6 @@ 
+/* PR debug/45500 */
+/* { dg-do compile } */
+/* { dg-options "-g -msse" } */
+
+typedef char V __attribute__ ((__vector_size__ (16)));
+static const V s = { '\n', '\r', '?', '\\' };