From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9687 invoked by alias); 11 Oct 2011 11:42:42 -0000 Received: (qmail 9677 invoked by uid 22791); 11 Oct 2011 11:42:41 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Oct 2011 11:42:26 +0000 From: "krebbel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/50661] std::equal should use more efficient version for arrays of pointers Date: Tue, 11 Oct 2011 11:42:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: krebbel 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: 2011-10/txt/msg00982.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50661 --- Comment #16 from Andreas Krebbel 2011-10-11 11:41:12 UTC --- (In reply to comment #15) > Andreas, can I have your feedback about this? Is it safe or not to compare s390 > pointers with memcmp? On s390 with 31 bit addressing the uppermost bit indicates to the hardware that 31 bit addressing is used instead of just 24 bit. This indeed is a problem when creating pointers from integers, what is anyway not backed by the C standard, or when using __builtin_return_address without masking the bits. However GCC does *not* mask the bits when comparing two pointer values. So (void*)0x00000000 == (void*)0x80000000 does *not* evaluate to true on s390. To my understanding using a memcmp would not break things for s390. If it is broken with memcmp it was broken before as well. I don't know how this works with ARM. I think they put their THUMB markers into the lower order bits of an address and perhaps we should better check how they implement a pointer compare.