Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch. This patch covers the go front end.
Ok?
* godump.c: Include wide-int-print.h. (go_output_typedef): Use wide-int interfaces. go: * go-gcc.cc (Gcc_backend::type_size): Use tree_fits_uhwi_p. diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 83f91d5..578aff0 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -830,8 +830,7 @@ Gcc_backend::type_size(Btype* btype) if (t == error_mark_node) return 1; t = TYPE_SIZE_UNIT(t); - gcc_assert(TREE_CODE(t) == INTEGER_CST); - gcc_assert(TREE_INT_CST_HIGH(t) == 0); + gcc_assert(tree_fits_uhwi_p (t)); unsigned HOST_WIDE_INT val_wide = TREE_INT_CST_LOW(t); size_t ret = static_cast<size_t>(val_wide); gcc_assert(ret == val_wide); diff --git a/gcc/godump.c b/gcc/godump.c index 3efbc7c..07edbc9 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include "pointer-set.h" #include "obstack.h" #include "debug.h" +#include "wide-int-print.h" /* We dump this information from the debug hooks. This gives us a stable and maintainable API to hook into. In order to work @@ -967,7 +968,7 @@ go_output_typedef (struct godump_container *container, tree decl) const char *name; struct macro_hash_value *mhval; void **slot; - char buf[100]; + char buf[WIDE_INT_PRINT_BUFFER_SIZE]; name = IDENTIFIER_POINTER (TREE_PURPOSE (element)); @@ -988,10 +989,7 @@ go_output_typedef (struct godump_container *container, tree decl) snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_UNSIGNED, tree_to_uhwi (TREE_VALUE (element))); else - snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DOUBLE_HEX, - ((unsigned HOST_WIDE_INT) - TREE_INT_CST_HIGH (TREE_VALUE (element))), - TREE_INT_CST_LOW (TREE_VALUE (element))); + print_hex (element, buf); mhval->value = xstrdup (buf); *slot = mhval;