public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/49101] New: [x32] Extra instruction in compare Date: Sat, 21 May 2011 14:06:00 -0000 [thread overview] Message-ID: <bug-49101-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49101 Summary: [x32] Extra instruction in compare Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: hjl.tools@gmail.com [hjl@gnu-6 ilp32-41]$ cat foo.c extern void abort (void); typedef __SIZE_TYPE__ size_t; extern size_t strcspn (const char *, const char *); extern char *strcpy (char *, const char *); int main (void) { char *s1 = "hello world"; char dst[64], *d2; strcpy (dst, s1); d2 = dst; if (strcspn (++d2+5, "") != 5) abort(); return 0; } [hjl@gnu-6 ilp32-41]$ make foo.s /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -S -o foo.s -mx32 -O foo.c [hjl@gnu-6 ilp32-41]$ cat foo.s .file "foo.c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc subq $72, %rsp .cfi_def_cfa_offset 80 movl $1819043176, (%rsp) movl $1870078063, 4(%rsp) movl $6581362, 8(%rsp) leaq 6(%rsp), %rdi movl $0, %eax movq $-1, %rcx repnz scasb notq %rcx cmpl $6, %ecx je .L2 call abort .L2: movl $0, %eax addq $72, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (GNU) 4.7.0 20110521 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 ilp32-41]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o 64.s -O foo.c [hjl@gnu-6 ilp32-41]$ diff -up 64.s foo.s --- 64.s 2011-05-21 06:16:11.260010306 -0700 +++ foo.s 2011-05-21 06:15:38.076996129 -0700 @@ -14,7 +14,8 @@ main: movl $0, %eax movq $-1, %rcx repnz scasb - cmpq $-7, %rcx + notq %rcx + cmpl $6, %ecx je .L2 call abort .L2: [hjl@gnu-6 ilp32-41]$ X32 generates notq %rcx cmpl $6, %ecx instead of cmpq $-7, %rcx
reply other threads:[~2011-05-21 13:43 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=bug-49101-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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: linkBe 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).