aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2012-10-08 00:10:20 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2012-10-08 00:10:20 +0000
commit63f2a6a5aaf319329c33a7cfd342f3aaa763b883 (patch)
treea42da8cdcabebec6b9766fdf32191dc22c43dded /gcc
parent81bd268ceb57db1d3996b63b66054b4dce8dbb06 (diff)
downloadgcc-63f2a6a5aaf319329c33a7cfd342f3aaa763b883.zip
gcc-63f2a6a5aaf319329c33a7cfd342f3aaa763b883.tar.gz
gcc-63f2a6a5aaf319329c33a7cfd342f3aaa763b883.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/mmix/mmix.c19
2 files changed, 14 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ef8297d..8f944d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-08 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * 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 <rdsandiford@googlemail.com>
* machmode.h (GET_MODE_UNIT_PRECISION): New macro.
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index d5d72df..26668e7 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");