From: Paul Edwards <mutazilah@gmail.com>
To: GCC Development <gcc@gcc.gnu.org>
Subject: gcc 3.2.3 x64 negative indexes
Date: Wed, 7 Feb 2024 23:02:51 +0800 [thread overview]
Message-ID: <CAMi4NxaOSAhwnNTkbOiC7nz_0GfF72e9uTszs6HNTAhwqh5MMA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 475 bytes --]
Hi.
I am using a slightly modified gcc 3.2.3 for x86_64 and for this code:
int fff(char *x)
{
return (x[-1]);
}
It is generating:
.globl fff
fff:
.LFB2:
movl $4294967295, %eax
movsbl (%rax,%rcx),%eax
ret
My understanding is that that move of -1 into eax
does NOT sign-extend, and thus results in a very
high index, which causes a crash.
I may have stuffed something up myself.
Anyone know which code governs this behavior?
Thanks. Paul.
next reply other threads:[~2024-02-07 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 15:02 Paul Edwards [this message]
2024-02-07 15:12 ` Jakub Jelinek
2024-02-09 21:34 ` Paul Edwards
2024-02-09 21:38 ` Paul Edwards
2024-02-10 13:41 ` Paul Edwards
2024-02-10 17:42 ` Joe Monk
2024-02-10 19:48 ` Paul Edwards
2024-02-11 0:03 ` Paul Edwards
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=CAMi4NxaOSAhwnNTkbOiC7nz_0GfF72e9uTszs6HNTAhwqh5MMA@mail.gmail.com \
--to=mutazilah@gmail.com \
--cc=gcc@gcc.gnu.org \
/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).