]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: THEAD: Fix improper immediate value for MODIFY_DISP instruction on 32-bit...
authorJin Ma <jinma@linux.alibaba.com>
Mon, 29 Jan 2024 09:57:00 +0000 (17:57 +0800)
committerChristoph Müllner <christoph.muellner@vrull.eu>
Tue, 30 Jan 2024 06:38:13 +0000 (07:38 +0100)
When using  '%ld' to print 'long long int' variable, 'fprintf' will
produce messy output on a 32-bit system, in an incorrect instruction
being generated, such as 'th.lwib a1,(a0),-16,4294967295'. And the
following error occurred during compilation:

Assembler messages:
Error: improper immediate value (18446744073709551615)

gcc/ChangeLog:

* config/riscv/thead.cc (th_print_operand_address): Change %ld
to %lld.

gcc/config/riscv/thead.cc

index 2955bc5f8a9b926ed23f3dbb9a88c495c7009d92..e4b8c37bc28ea313f4f47617177dab8ac856646d 100644 (file)
@@ -1141,7 +1141,7 @@ th_print_operand_address (FILE *file, machine_mode mode, rtx x)
       return true;
 
     case ADDRESS_REG_WB:
-      fprintf (file, "(%s),%ld,%u", reg_names[REGNO (addr.reg)],
+      fprintf (file, "(%s),"HOST_WIDE_INT_PRINT_DEC",%u", reg_names[REGNO (addr.reg)],
               INTVAL (addr.offset) >> addr.shift, addr.shift);
        return true;