public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jin Ma" <jinma@linux.alibaba.com>
To: "Andrew Pinski" <pinskia@gmail.com>
Cc: "gcc-patches" <gcc-patches@gcc.gnu.org>,
	"jeffreyalaw" <jeffreyalaw@gmail.com>,
	"palmer" <palmer@dabbelt.com>,
	"richard.sandiford" <richard.sandiford@arm.com>,
	"kito.cheng" <kito.cheng@gmail.com>,
	"christoph.muellner" <christoph.muellner@vrull.eu>,
	"rdapp.gcc" <rdapp.gcc@gmail.com>,
	"juzhe.zhong" <juzhe.zhong@rivai.ai>,
	"jinma.contrib" <jinma.contrib@gmail.com>
Subject: Re:[PATCH] RISC-V: THEAD: Fix improper immediate value for MODIFY_DISP instruction on 32-bit systems.
Date: Mon, 29 Jan 2024 17:36:12 +0800	[thread overview]
Message-ID: <b66eaeb5-897f-4627-b357-555516f7049a.jinma@linux.alibaba.com> (raw)
In-Reply-To: <CA+=Sn1ksPX-QKKU+m1_9fc5dubOAas=L9XV-Va8pZukDR0aKfw@mail.gmail.com>

>On Mon, Jan 29, 2024 at 1:21=E2=80=AFAM Jin Ma <jinma@linux.alibaba.com> wr=
>ote:
>>
>> 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 | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc
>> index 2955bc5f8a9..9ee6444b627 100644
>> --- a/gcc/config/riscv/thead.cc
>> +++ b/gcc/config/riscv/thead.cc
>> @@ -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),%lld,%u", reg_names[REGNO (addr.reg)],
>>                INTVAL (addr.offset) >> addr.shift, addr.shift);


>This is wrong, you should instead use HOST_WIDE_INT_PRINT_DEC or
>HOST_WIDE_INT_PRINT_UNSIGNED.

>Thanks,
>Andrew Pinski

Yes, thank you very much for your guidance. It will be better to
use HOST_WIDE_INT_PRINT_DEC. I will make changes later :)

BR

Jin

>>         return true;

  reply	other threads:[~2024-01-29  9:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29  9:20 [PATCH] " Jin Ma
2024-01-29  9:23 ` Andrew Pinski
2024-01-29  9:36   ` Jin Ma [this message]
2024-01-29  9:57 ` [PATCH v2] " Jin Ma
2024-01-29 12:32   ` Kito Cheng
2024-01-30  6:40     ` Christoph Müllner
2024-02-03 13:11       ` Andreas Schwab
2024-02-05 12:00         ` Christoph Müllner
2024-02-05 14:56           ` Jeff Law
2024-02-05 15:08             ` Andreas Schwab
2024-02-05 15:34               ` Jeff Law
2024-02-05 15:39                 ` Andreas Schwab
2024-02-05 23:23             ` Christoph Müllner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b66eaeb5-897f-4627-b357-555516f7049a.jinma@linux.alibaba.com \
    --to=jinma@linux.alibaba.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jinma.contrib@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pinskia@gmail.com \
    --cc=rdapp.gcc@gmail.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).