RFR: 8011760 assert(delta != 0) failed: dup pointer in MemBaseline::malloc_sort_by_addr

David Holmes david.holmes at oracle.com
Tue Jul 9 21:45:13 PDT 2013


On 9/07/2013 3:23 AM, Zhengyu Gu wrote:
> This is a simple fix to qsort's comparison function. The bug is related to libc version, it only happens on Linux 32 bit with certain versions of libc. The one I used to reproduce, is libc-2.11.1.so.
>
> Most of qsort algorithms do not compare element to itself, but apparently it is not the case with certain version of Linux 32 libc implementation.

Sorry but I don't get it. You are asserting that the pointers/addresses 
should be distinct but you skip the assert if they are equal ???

   int MemBaseline::malloc_sort_by_addr(const void* p1, const void* p2) {
     assert(MemTracker::is_on(), "Just check");
     const MemPointerRecord* mp1 = (const MemPointerRecord*)p1;
     const MemPointerRecord* mp2 = (const MemPointerRecord*)p2;
     int delta = UNSIGNED_COMPARE(mp1->addr(), mp2->addr());
!   assert(p1 == p2 || delta != 0, "dup pointer");
     return delta;
   }

And is there some case where delta==0 but p1 != p2 ?

Thanks,
David

>
> JBS:   https://jbs.oracle.com/bugs/browse/JDK-8011760
> Public bug: not available
> Webrev:  http://cr.openjdk.java.net/~zgu/8011760/webrev.00/
>
>
> Thanks,
>
> -Zhengyu
>


More information about the hotspot-runtime-dev mailing list