This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix dwarf2 problem with generic vectors


This fixes PR 28692.

The problem was that stor-layout will never set the TYPE_MODE to a
vector mode which is not supported by the target (that is, a generic
vector).  Thus, when expand_expr looks at a constant of a type that
ought to have a generic vector mode, it can't produce a CONST_VECTOR,
because it can't see what mode it should have; instead it dumps it to
memory, which is not what we want in this code.  This patch avoids the
limitation by not outputting a DW_AT_const_value for such constants.

Also, expand_expr always dumps complex constants to memory, so similar
treatment is required.

Bootstrapped & tested on powerpc-darwin8.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-pr28692.patch=========================
Index: gcc/ChangeLog
2006-08-21  Geoffrey Keating  <geoffk@apple.com>

	PR debug/28692
	* dwarf2out.c (rtl_for_decl_init): Don't try to create RTL for
	complex values, nor for generic vector values.

Index: gcc/testsuite/ChangeLog
2006-08-21  Geoffrey Keating  <geoffk@apple.com>

	PR debug/28692
	* gcc.dg/debug/const-1.c: New.
	* gcc.dg/debug/const-2.c: New.
	* gcc.dg/debug/dwarf2/const-1.c: New.
	* gcc.dg/debug/dwarf2/const-2.c: New.
	* gcc.dg/debug/dwarf2/const-2b.c: New.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 116313)
+++ gcc/dwarf2out.c	(working copy)
@@ -9942,11 +9942,14 @@
 	rtl = gen_rtx_CONST_STRING (VOIDmode,
 				    ggc_strdup (TREE_STRING_POINTER (init)));
     }
-  /* Although DWARF could easily handle other kinds of aggregates, we
-     have no way to represent such values as RTL constants, so skip
-     those.  */
-  else if (AGGREGATE_TYPE_P (type))
+  /* Other aggregates, and complex values, could be represented using
+     CONCAT: FIXME!  */
+  else if (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_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)
+    ;
   /* If the initializer is something that we know will expand into an
      immediate RTL constant, expand it now.  We must be careful not to
      reference variables which won't be output.  */
Index: gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c	(revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O -gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+extern void x();
+static void (*f)() = x;
Index: gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/const-2.c	(revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-O -gdwarf-2 -dA -maltivec" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+typedef float FloatVect __attribute__((__vector_size__(16)));
+static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
Index: gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c	(revision 0)
+++ gcc/testsuite/gcc.dg/debug/dwarf2/const-2b.c	(revision 0)
@@ -0,0 +1,6 @@
+/* { dg-do compile { target i386*-*-* } } */
+/* { dg-options "-O -gdwarf-2 -dA -msse" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+typedef float FloatVect __attribute__((__vector_size__(16)));
+static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
Index: gcc/testsuite/gcc.dg/debug/const-1.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/const-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/debug/const-1.c	(revision 0)
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+typedef float FloatVect __attribute__((__vector_size__(16)));
+static FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
Index: gcc/testsuite/gcc.dg/debug/const-2.c
===================================================================
--- gcc/testsuite/gcc.dg/debug/const-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/debug/const-2.c	(revision 0)
@@ -0,0 +1,2 @@
+/* { dg-do compile } */
+static __complex__ int x = 3.0;
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]