From: Hans-Peter Nilsson Date: Mon, 8 Oct 2012 00:10:20 +0000 (+0000) Subject: mmix.c (mmix_output_octa): Don't assume HOST_WIDEST_INT_PRINT_HEX starts with "0x". X-Git-Tag: misc/gccgo-go1_1_2~344 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63f2a6a5aaf319329c33a7cfd342f3aaa763b883;p=thirdparty%2Fgcc.git mmix.c (mmix_output_octa): Don't assume HOST_WIDEST_INT_PRINT_HEX starts with "0x". * config/mmix/mmix.c (mmix_output_octa): Don't assume HOST_WIDEST_INT_PRINT_HEX starts with "0x". Instead use HOST_WIDE_INT_PRINT_HEX_PURE, falling back to HOST_WIDEST_INT_PRINT_UNSIGNED. From-SVN: r192189 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef8297d7ed26..8f944d7fd581 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2012-10-08 Hans-Peter Nilsson + + * config/mmix/mmix.c (mmix_output_octa): Don't assume + HOST_WIDEST_INT_PRINT_HEX starts with "0x". Instead use + HOST_WIDE_INT_PRINT_HEX_PURE, falling back to + HOST_WIDEST_INT_PRINT_UNSIGNED. + 2012-10-07 Richard Sandiford * machmode.h (GET_MODE_UNIT_PRECISION): New macro. diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index d5d72dfdcadb..26668e76da8f 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -2499,19 +2499,9 @@ mmix_output_shiftvalue_op_from_str (FILE *stream, static void mmix_output_octa (FILE *stream, HOST_WIDEST_INT value, int do_begin_end) { - /* Snipped from final.c:output_addr_const. We need to avoid the - presumed universal "0x" prefix. We can do it by replacing "0x" with - "#0" here; we must avoid a space in the operands and no, the zero - won't cause the number to be assumed in octal format. */ - char hex_format[sizeof (HOST_WIDEST_INT_PRINT_HEX)]; - if (do_begin_end) fprintf (stream, "\tOCTA "); - strcpy (hex_format, HOST_WIDEST_INT_PRINT_HEX); - hex_format[0] = '#'; - hex_format[1] = '0'; - /* Provide a few alternative output formats depending on the number, to improve legibility of assembler output. */ if ((value < (HOST_WIDEST_INT) 0 && value > (HOST_WIDEST_INT) -10000) @@ -2520,8 +2510,13 @@ mmix_output_octa (FILE *stream, HOST_WIDEST_INT value, int do_begin_end) else if (value > (HOST_WIDEST_INT) 0 && value < ((HOST_WIDEST_INT) 1 << 31) * 2) fprintf (stream, "#%x", (unsigned int) value); - else - fprintf (stream, hex_format, value); + else if (sizeof (HOST_WIDE_INT) == sizeof (HOST_WIDEST_INT)) + /* We need to avoid the not-so-universal "0x" prefix; we need the + pure hex-digits together with the mmixal "#" hex prefix. */ + fprintf (stream, "#" HOST_WIDE_INT_PRINT_HEX_PURE, + (HOST_WIDE_INT) value); + else /* Need to avoid the hex output; there's no ...WIDEST...HEX_PURE. */ + fprintf (stream, HOST_WIDEST_INT_PRINT_UNSIGNED, value); if (do_begin_end) fprintf (stream, "\n");