From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3712 invoked by alias); 22 Feb 2013 15:01:40 -0000 Received: (qmail 3616 invoked by uid 48); 22 Feb 2013 15:01:12 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55309] gcc's address-sanitizer 66% slower than clang's Date: Fri, 22 Feb 2013 15:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg02238.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55309 --- Comment #51 from Jakub Jelinek 2013-02-22 15:01:08 UTC --- Looks like a real SPEC bug to me. PerlIO_funcs * PerlIO_find_layer(pTHX_ const char *name, STRLEN len, int load) { IV i; if ((SSize_t) len <= 0) len = strlen(name); for (i = 0; i < PL_known_layers->cur; i++) { PerlIO_funcs *f = PL_known_layers->array[i].funcs; if (memEQ(f->name, name, len) && f->name[len] == 0) { PerlIO_debug("%.*s => %p\n", (int) len, name, (void*)f); return f; } } memEQ is memcmp, and my reading of ISO C99 or http://pubs.opengroup.org/onlinepubs/9699919799/functions/memcmp.html is that it is a bug to call memcmp ("abcdef", "defg", 6). A valid memcmp implementation could preread all bytes from both arrays (of the given length) and only then compare. And, at least some implementations (e.g. glibc string/memcmp.c) does that if the two strings aren't starting at the same address modulo size of word.