Blame SOURCES/Judy-1.0.5-undefined-behavior.patch

257f0b
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyByCount.c judy-1.0.5/src/JudyCommon/JudyByCount.c
257f0b
*** judy-1.0.5-orig/src/JudyCommon/JudyByCount.c	2005-02-15 15:06:07.000000000 -0600
257f0b
--- judy-1.0.5/src/JudyCommon/JudyByCount.c	2014-02-18 13:45:35.225145230 -0600
257f0b
***************
257f0b
*** 817,823 ****
257f0b
  // Shorthand for where to find start of Index bytes array:
257f0b
  
257f0b
  #ifdef JUDY1
257f0b
! #define	PJI (Pjp->jp_1Index)
257f0b
  #else
257f0b
  #define	PJI (Pjp->jp_LIndex)
257f0b
  #endif
257f0b
--- 817,823 ----
257f0b
  // Shorthand for where to find start of Index bytes array:
257f0b
  
257f0b
  #ifdef JUDY1
257f0b
! #define	PJI (Pjp->jp_2Index)
257f0b
  #else
257f0b
  #define	PJI (Pjp->jp_LIndex)
257f0b
  #endif
257f0b
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyGet.c judy-1.0.5/src/JudyCommon/JudyGet.c
257f0b
*** judy-1.0.5-orig/src/JudyCommon/JudyGet.c	2005-02-15 15:06:07.000000000 -0600
257f0b
--- judy-1.0.5/src/JudyCommon/JudyGet.c	2014-02-18 13:49:50.840632644 -0600
257f0b
***************
257f0b
*** 630,636 ****
257f0b
  #ifdef JUDY1
257f0b
  
257f0b
  #define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX)                       \
257f0b
! if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX))       \
257f0b
      return(1)
257f0b
  
257f0b
  #define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY)                   \
257f0b
--- 630,636 ----
257f0b
  #ifdef JUDY1
257f0b
  
257f0b
  #define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX)                       \
257f0b
! if (((LEAF_T *)((PJP)->jp_2Index))[(IDX) - 1] == (LEAF_T)(INDEX))       \
257f0b
      return(1)
257f0b
  
257f0b
  #define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY)                   \
257f0b
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyIns.c judy-1.0.5/src/JudyCommon/JudyIns.c
257f0b
*** judy-1.0.5-orig/src/JudyCommon/JudyIns.c	2005-02-15 15:06:07.000000000 -0600
257f0b
--- judy-1.0.5/src/JudyCommon/JudyIns.c	2014-02-18 13:00:49.871850635 -0600
257f0b
***************
257f0b
*** 1503,1509 ****
257f0b
              JU_BITMAPSETL(Pjlb, Index);
257f0b
  
257f0b
              for (offset = 0; offset < 15; ++offset)
257f0b
!                 JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]);
257f0b
  
257f0b
  //          Set jp_DcdPopO including the current pop0; incremented later:
257f0b
              DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1;
257f0b
--- 1503,1510 ----
257f0b
              JU_BITMAPSETL(Pjlb, Index);
257f0b
  
257f0b
              for (offset = 0; offset < 15; ++offset)
257f0b
! //              JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]); // elements 8..15 are optimized out by gcc, so need to do the following
257f0b
!               JU_BITMAPSETL(Pjlb, Pjp->jp_2Index[offset]);
257f0b
  
257f0b
  //          Set jp_DcdPopO including the current pop0; incremented later:
257f0b
              DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1;
257f0b
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyPrevNext.c judy-1.0.5/src/JudyCommon/JudyPrevNext.c
257f0b
*** judy-1.0.5-orig/src/JudyCommon/JudyPrevNext.c	2005-02-15 15:06:07.000000000 -0600
257f0b
--- judy-1.0.5/src/JudyCommon/JudyPrevNext.c	2014-02-18 13:45:40.972875737 -0600
257f0b
***************
257f0b
*** 907,913 ****
257f0b
  // Shorthand for where to find start of Index bytes array:
257f0b
  
257f0b
  #ifdef JUDY1
257f0b
! #define	PJI (Pjp->jp_1Index)
257f0b
  #else
257f0b
  #define	PJI (Pjp->jp_LIndex)
257f0b
  #endif
257f0b
--- 907,913 ----
257f0b
  // Shorthand for where to find start of Index bytes array:
257f0b
  
257f0b
  #ifdef JUDY1
257f0b
! #define	PJI (Pjp->jp_2Index)
257f0b
  #else
257f0b
  #define	PJI (Pjp->jp_LIndex)
257f0b
  #endif
257f0b
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyPrivateBranch.h judy-1.0.5/src/JudyCommon/JudyPrivateBranch.h
257f0b
*** judy-1.0.5-orig/src/JudyCommon/JudyPrivateBranch.h	2005-02-15 15:06:07.000000000 -0600
257f0b
--- judy-1.0.5/src/JudyCommon/JudyPrivateBranch.h	2014-02-18 13:00:39.510533765 -0600
257f0b
***************
257f0b
*** 86,91 ****
257f0b
--- 86,98 ----
257f0b
          } jpi_t;
257f0b
  
257f0b
  
257f0b
+ typedef struct _JUDY_POINTER_IMMED2      // JPI2.
257f0b
+         {
257f0b
+             uint8_t j_pi_2Index[2 * sizeof(Word_t) - 1];        // see above.
257f0b
+             uint8_t j_pi_Type;                  // JP type, 1 of cJ*_JPIMMED*.
257f0b
+         } jpi2_t;
257f0b
+ 
257f0b
+ 
257f0b
  // UNION OF JP TYPES:
257f0b
  //
257f0b
  // A branch is an array of cJU_BRANCHUNUMJPS (256) of this object, or an
257f0b
***************
257f0b
*** 97,102 ****
257f0b
--- 104,110 ----
257f0b
          {
257f0b
              jpo_t j_po;                 // other than immediate indexes.
257f0b
              jpi_t j_pi;                 // immediate indexes.
257f0b
+             jpi2_t j_pi2;               // immediate indexes using j_pi_LIndex as well
257f0b
          } jp_t, *Pjp_t;
257f0b
  
257f0b
  // For coding convenience:
257f0b
***************
257f0b
*** 105,110 ****
257f0b
--- 113,119 ----
257f0b
  
257f0b
  #define jp_1Index  j_pi.j_pi_1Index     // for storing Indexes in first  word.
257f0b
  #define jp_LIndex  j_pi.j_pi_LIndex     // for storing Indexes in second word.
257f0b
+ #define jp_2Index  j_pi2.j_pi_2Index     // for storing Indexes spanning both words.
257f0b
  #define jp_Addr    j_po.j_po_Addr
257f0b
  //#define       jp_DcdPop0 j_po.jpo_u.j_po_DcdPop0
257f0b
  #define jp_Type    j_po.jpo_u.j_po_Bytes[sizeof(Word_t) - 1]