public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/47812] New: [x32] __builtin_strlen is miscompiled at -O2
@ 2011-02-19  0:56 hjl.tools at gmail dot com
  2011-02-19  7:47 ` [Bug target/47812] " xinliangli at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2011-02-19  0:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47812

           Summary: [x32] __builtin_strlen is miscompiled at -O2
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: ubizjak@gmail.com


On x32 branch, I got

[hjl@gnu-6 strcat-1]$ cat tester.c
char one[50] = "ijk";
int
main (void)
{
  return __builtin_strlen (one) != 3;
}
[hjl@gnu-6 strcat-1]$ make tester.s
/usr/gcc-4.6.0-x32/bin/gcc -mx32 -g -O2 -S tester.c -o tester.s
[hjl@gnu-6 strcat-1]$ cat tester.s
    .file    "tester.c"
    .text
.Ltext0:
    .section    .text.startup,"ax",@progbits
    .p2align 4,,15
    .globl    main
    .type    main, @function
main:
.LFB0:
    .file 1 "tester.c"
    .loc 1 4 0
    .cfi_startproc
    .loc 1 5 0
    movl    $one, %edx
.L2:
    movl    (%rdx), %eax
    addq    $4, %rdx
    leal    -16843009(%eax), %ecx
    notl    %eax
    andl    %eax, %ecx
    andl    $-2139062144, %ecx
    je    .L2
    .loc 1 6 0
    movl    $1, %eax
    ret
    .cfi_endproc

This always returns 1 instead of 0.


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

end of thread, other threads:[~2011-02-19 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-19  0:56 [Bug target/47812] New: [x32] __builtin_strlen is miscompiled at -O2 hjl.tools at gmail dot com
2011-02-19  7:47 ` [Bug target/47812] " xinliangli at gmail dot com
2011-02-19  7:47 ` xinliangli at gmail dot com
2011-02-19 14:53 ` hjl.tools at gmail dot com

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