aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2017-05-31 00:06:11 +0000
committerMax Filippov <jcmvbkbc@gmail.com>2017-05-31 00:06:11 +0000
commit0fab7c1a2bda11504895141e603397e45c25c6e6 (patch)
treeca0e9ce1688488d68ca6cf04bbecb44aeaf0e835
parent3bc389467473856bdb081eac40ee83fc67e278c7 (diff)
gcc: xtensa: fix fprintf format specifiers
HOST_WIDE_INT may not be long as assumed in print_operand and xtensa_emit_call. Use HOST_WIDE_INT_PRINT_DEC/HOST_WIDE_INT_PRINT_HEX format strings instead of %ld/0x%lx. This fixes incorrect assembly code generation by the compiler running on armhf host. 2017-05-30 Max Filippov <jcmvbkbc@gmail.com> gcc/ Backport from mainline 2017-05-29 Max Filippov <jcmvbkbc@gmail.com> * config/xtensa/xtensa.c (xtensa_emit_call): Use HOST_WIDE_INT_PRINT_HEX instead of 0x%lx format string. (print_operand): Use HOST_WIDE_INT_PRINT_DEC instead of %ld format string. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@248715 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/xtensa/xtensa.c11
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 24d38651fea..cae691d5eaf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,16 @@
2017-05-30 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
+ 2017-05-29 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/xtensa.c (xtensa_emit_call): Use
+ HOST_WIDE_INT_PRINT_HEX instead of 0x%lx format string.
+ (print_operand): Use HOST_WIDE_INT_PRINT_DEC instead of %ld
+ format string.
+
+2017-05-30 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
2016-11-29 Max Filippov <jcmvbkbc@gmail.com>
* config/xtensa/xtensa.c (hwloop_optimize): Don't emit zero
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 70f698aba0a..2bdf5ccef97 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1776,7 +1776,8 @@ xtensa_emit_call (int callop, rtx *operands)
rtx tgt = operands[callop];
if (GET_CODE (tgt) == CONST_INT)
- sprintf (result, "call%d\t0x%lx", WINDOW_SIZE, INTVAL (tgt));
+ sprintf (result, "call%d\t" HOST_WIDE_INT_PRINT_HEX,
+ WINDOW_SIZE, INTVAL (tgt));
else if (register_operand (tgt, VOIDmode))
sprintf (result, "callx%d\t%%%d", WINDOW_SIZE, callop);
else
@@ -2347,14 +2348,14 @@ print_operand (FILE *file, rtx x, int letter)
case 'L':
if (GET_CODE (x) == CONST_INT)
- fprintf (file, "%ld", (32 - INTVAL (x)) & 0x1f);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, (32 - INTVAL (x)) & 0x1f);
else
output_operand_lossage ("invalid %%L value");
break;
case 'R':
if (GET_CODE (x) == CONST_INT)
- fprintf (file, "%ld", INTVAL (x) & 0x1f);
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) & 0x1f);
else
output_operand_lossage ("invalid %%R value");
break;
@@ -2368,7 +2369,7 @@ print_operand (FILE *file, rtx x, int letter)
case 'd':
if (GET_CODE (x) == CONST_INT)
- fprintf (file, "%ld", INTVAL (x));
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
else
output_operand_lossage ("invalid %%d value");
break;
@@ -2433,7 +2434,7 @@ print_operand (FILE *file, rtx x, int letter)
else if (GET_CODE (x) == MEM)
output_address (GET_MODE (x), XEXP (x, 0));
else if (GET_CODE (x) == CONST_INT)
- fprintf (file, "%ld", INTVAL (x));
+ fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
else
output_addr_const (file, x);
}