public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc 3.2.3 x64 negative indexes
@ 2024-02-07 15:02 Paul Edwards
  2024-02-07 15:12 ` Jakub Jelinek
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Edwards @ 2024-02-07 15:02 UTC (permalink / raw)
  To: GCC Development

[-- 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-11  0:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 15:02 gcc 3.2.3 x64 negative indexes Paul Edwards
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

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).