From patchwork Wed Jun 29 13:54:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 13482 Received: (qmail 104114 invoked by alias); 29 Jun 2016 13:54:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 104097 invoked by uid 89); 29 Jun 2016 13:54:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de From: Andreas Schwab To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Avoid array-bounds warning in testsuite on i586 References: <0b8978ab-440b-d00b-78f4-a51d91a3c813@redhat.com> X-Yow: I'm not an Iranian!! I voted for Dianne Feinstein!! Date: Wed, 29 Jun 2016 15:54:06 +0200 In-Reply-To: <0b8978ab-440b-d00b-78f4-a51d91a3c813@redhat.com> (Florian Weimer's message of "Wed, 29 Jun 2016 13:32:47 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Florian Weimer writes: > Or we could cast to uintptr_t before subtracting 1. That works. Andreas. Subject: [PATCH] Avoid array-bounds warning for strncat on i586 [BZ #20260] * sysdeps/x86/bits/string.h (__strncat_g) [!__i686__]: Compute the address before the beginning of the string as an integer to avoid array-bounds warning. --- sysdeps/x86/bits/string.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sysdeps/x86/bits/string.h b/sysdeps/x86/bits/string.h index 8dfce05..805d33f 100644 --- a/sysdeps/x86/bits/string.h +++ b/sysdeps/x86/bits/string.h @@ -1089,7 +1089,6 @@ __strncat_g (char *__dest, const char __src[], size_t __n) : "g" (__n), "0" (0), "1" (__tmp), "2" (__src), "3" (0xffffffff) : "memory", "cc"); # else - --__tmp; __asm__ __volatile__ ("1:\n\t" "cmpb $0,1(%1)\n\t" @@ -1108,7 +1107,7 @@ __strncat_g (char *__dest, const char __src[], size_t __n) "3:\n\t" "movb $0,(%1)" : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n) - : "1" (__tmp), "2" (__src), "3" (__n) + : "1" ((unsigned long) __tmp - 1), "2" (__src), "3" (__n) : "memory", "cc"); #endif return __dest;