This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4 PATCH] fix debug/24267
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Oct 2005 18:36:44 -0700
- Subject: [3.4 PATCH] fix debug/24267
This patch fixes PR debug/24267. The fix is a portion of a patch to
mainline. The bug is a regression, depending on how you look at it;
use of __vector was added to the 3.4 branch so the test could not be
run before that. __vector, particularly via <altivec.h>, replaces
the previously recommended way to declare vector variables for which
the DWARF information was not broken.
I'm not sure of the state of the 3.4 branch, but when it's open for
fixes is this OK? Bootstrapped and regtested on powerpc64-linux.
2005-10-07 Janis Johnson <janis187@us.ibm.com>
PR target/24267
Partial backport from mainline
2004-05-04 Paolo Bonzini <bonzini@gnu.org>
Richard Henderson <rth@redhat.com>
* tree.c (make_or_reuse_type): New.
(build_common_tree_nodes): Use it.
testsuite:
PR target/24267
* gcc.dg/debug/dwarf2/dwarf-altivec1.c: New test.
Index: gcc/tree.c
===================================================================
RCS file: /opt/gcc-cvs/gcc/gcc/tree.c,v
retrieving revision 1.342.2.6
diff -u -p -r1.342.2.6 tree.c
--- gcc/tree.c 28 Jul 2005 08:08:01 -0000 1.342.2.6
+++ gcc/tree.c 7 Oct 2005 22:08:14 -0000
@@ -4808,6 +4808,27 @@ finish_vector_type (tree t)
}
}
+static tree
+make_or_reuse_type (unsigned size, int unsignedp)
+{
+ if (size == INT_TYPE_SIZE)
+ return unsignedp ? unsigned_type_node : integer_type_node;
+ if (size == CHAR_TYPE_SIZE)
+ return unsignedp ? unsigned_char_type_node : signed_char_type_node;
+ if (size == SHORT_TYPE_SIZE)
+ return unsignedp ? short_unsigned_type_node : short_integer_type_node;
+ if (size == LONG_TYPE_SIZE)
+ return unsignedp ? long_unsigned_type_node : long_integer_type_node;
+ if (size == LONG_LONG_TYPE_SIZE)
+ return (unsignedp ? long_long_unsigned_type_node
+ : long_long_integer_type_node);
+
+ if (unsignedp)
+ return make_unsigned_type (size);
+ else
+ return make_signed_type (size);
+}
+
/* Create nodes for all integer types (and error_mark_node) using the sizes
of C datatypes. The caller should call set_sizetype soon after calling
this function to select one of the types as sizetype. */
@@ -4850,18 +4871,20 @@ build_common_tree_nodes (int signed_char
TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node;
TYPE_PRECISION (boolean_type_node) = 1;
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
- intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode));
-
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
- unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
-
+ /* Fill in the rest of the sized types. Reuse existing type nodes
+ when possible. */
+ intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 0);
+ intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 0);
+ intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 0);
+ intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 0);
+ intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 0);
+
+ unsigned_intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 1);
+ unsigned_intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 1);
+ unsigned_intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 1);
+ unsigned_intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 1);
+ unsigned_intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 1);
+
access_public_node = get_identifier ("public");
access_protected_node = get_identifier ("protected");
access_private_node = get_identifier ("private");
--- /dev/null 2004-06-24 11:06:20.000000000 -0700
+++ gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-altivec1.c 2005-10-07 16:33:02.000000000 -0700
@@ -0,0 +1,16 @@
+/* Verify that debug information does not have unknown names for
+ vector base types. */
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-gdwarf-2 -maltivec" } */
+
+__vector __bool vb;
+__vector float vf;
+__vector __pixel vp;
+__vector signed char vsc;
+__vector signed int vsi;
+__vector signed short vss;
+__vector unsigned char vuc;
+__vector unsigned int vui;
+__vector unsigned short vus;
+
+/* { dg-final { scan-assembler-not "__unknown__" } } */