All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Khem Raj <raj.khem@gmail.com>
Cc: grub-devel@gnu.org,  Daniel Kiper <daniel.kiper@oracle.com>,
	 Chester Lin <clin@suse.com>,  Nikita Ermakov <arei@altlinux.org>,
	 Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH] RISC-V: Restore the typcast to 64bit type
Date: Mon, 29 Mar 2021 12:24:23 +0200	[thread overview]
Message-ID: <mvm5z1a5kbs.fsf@suse.de> (raw)
In-Reply-To: <20210328224913.799167-1-raj.khem@gmail.com> (Khem Raj's message of "Sun, 28 Mar 2021 15:49:13 -0700")

On Mär 28 2021, Khem Raj wrote:

> this makes the type promotions clear and explicit
> It was already typecasted to long but was accidentally dropped in [1]

Note that long is 32-bit on riscv32, so the title is misleading (there
was no cast to 64-bit type before).  The cast really was a no-op, as it
didn't change the resulting type.  The issue is that the types of
sym_addr, target_section_addr and offset are Elf_Addr (aka Elf32_Addr),
which is an unsigned type (image_target->vaddr_offset is signed, but not
wider than Elf32_Addr, so it doesn't change the overall type).  Thus
when the result of the expression is extended to grub_int64_t it is
always a positive value instead of the desired sign-extended one.

> which stated to cause failures on riscv32 as reported in [2]

Most likely the missing addend masked the error.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


  reply	other threads:[~2021-03-29 10:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 22:49 [PATCH] RISC-V: Restore the typcast to 64bit type Khem Raj
2021-03-29 10:24 ` Andreas Schwab [this message]
2021-03-29 18:33   ` Khem Raj
2021-03-29 22:29     ` Daniel Kiper
2021-04-12 13:07       ` Daniel Kiper
  -- strict thread matches above, loose matches on Subject: below --
2021-03-28 22:45 Khem Raj

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=mvm5z1a5kbs.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=alistair.francis@wdc.com \
    --cc=arei@altlinux.org \
    --cc=clin@suse.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=raj.khem@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.