From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3396 invoked by alias); 25 Jul 2011 12:48:08 -0000 Received: (qmail 3380 invoked by uid 22791); 25 Jul 2011 12:48:07 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SARE_SUB_6CONS_WORD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jul 2011 12:47:51 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6PClpcr029869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Jul 2011 08:47:51 -0400 Received: from hase.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6PClnRX018781 for ; Mon, 25 Jul 2011 08:47:50 -0400 From: Andreas Schwab To: libc-hacker@sourceware.org Subject: [PATCH] Fix inline strncat/strncmp on x86 X-Yow: I'm protected by a ROLL-ON I rented from AVIS.. Date: Mon, 25 Jul 2011 12:48:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00014.txt.bz2 2011-07-25 Andreas Schwab * sysdeps/i386/i486/bits/string.h (__strncat_g): Correctly handle __n bigger than INT_MAX+1. (__strncmp_g): Likewise. --- sysdeps/i386/i486/bits/string.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index 9f05c7e..1f4d837 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -1058,8 +1058,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n) "movl %4, %3\n\t" "decl %1\n\t" "1:\n\t" - "decl %3\n\t" - "js 2f\n\t" + "subl $1,%3\n\t" + "jc 2f\n\t" "movb (%2),%b0\n\t" "movsb\n\t" "testb %b0,%b0\n\t" @@ -1078,8 +1078,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n) "leal 1(%1),%1\n\t" "jne 1b\n" "2:\n\t" - "decl %3\n\t" - "js 3f\n\t" + "subl $1,%3\n\t" + "jc 3f\n\t" "movb (%2),%b0\n\t" "leal 1(%2),%2\n\t" "movb %b0,(%1)\n\t" @@ -1219,8 +1219,8 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n) register int __res; __asm__ __volatile__ ("1:\n\t" - "decl %3\n\t" - "js 2f\n\t" + "subl $1,%3\n\t" + "jc 2f\n\t" "movb (%1),%b0\n\t" "incl %1\n\t" "cmpb %b0,(%2)\n\t" -- 1.7.6 -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different."