This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/50661] std::equal should use more efficient version for arrays of pointers
- From: "krebbel at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Oct 2011 11:41:12 +0000
- Subject: [Bug libstdc++/50661] std::equal should use more efficient version for arrays of pointers
- Auto-submitted: auto-generated
- References: <bug-50661-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50661
--- Comment #16 from Andreas Krebbel <krebbel at gcc dot gnu.org> 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.