Jakub discovered that -fdump-go-spec crashes when it tries to print an enum value which does not fit in a signed HOST_WIDE_INT. This patch fixes the problem. Bootstrapped and tested on x86_64-unknown-linux-gnu. Committed to mainline.
Ian 2011-10-03 Jakub Jelinek <ja...@redhat.com> Ian Lance Taylor <i...@google.com> * godump.c (go_output_typedef): Support printing enum values that don't fit in a signed HOST_WIDE_INT.
Index: godump.c =================================================================== --- godump.c (revision 179472) +++ godump.c (working copy) @@ -920,9 +920,20 @@ go_output_typedef (struct godump_contain if (*slot == NULL) { *slot = CONST_CAST (char *, name); - fprintf (go_dump_file, - "const _%s = " HOST_WIDE_INT_PRINT_DEC "\n", - name, tree_low_cst (TREE_VALUE (element), 0)); + fprintf (go_dump_file, "const _%s = ", name); + if (host_integerp (TREE_VALUE (element), 0)) + fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DEC, + tree_low_cst (TREE_VALUE (element), 0)); + else if (host_integerp (TREE_VALUE (element), 1)) + fprintf (go_dump_file, HOST_WIDE_INT_PRINT_UNSIGNED, + ((unsigned HOST_WIDE_INT) + tree_low_cst (TREE_VALUE (element), 1))); + else + fprintf (go_dump_file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, + ((unsigned HOST_WIDE_INT) + TREE_INT_CST_HIGH (TREE_VALUE (element))), + TREE_INT_CST_LOW (TREE_VALUE (element))); + fprintf (go_dump_file, "\n"); } } pointer_set_insert (container->decls_seen, TREE_TYPE (decl));