Skip to content

Commit

Permalink
Compare only address part of pointers in GC_ADDR_LT() on CHERI
Browse files Browse the repository at this point in the history
Issue #627 (bdwgc).

* include/gc/gc.h [__GNUC__ && __CHERI_PURE_CAPABILITY__] (GC_ADDR_LT):
Cast pointers to GC_word before comparison.
  • Loading branch information
ivmai committed Oct 29, 2024
1 parent 7872917 commit 9ac83d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/gc/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ typedef GC_word GC_uintptr_t;
/* arguments should be of the same pointer type, e.g. of char* type. */
/* Ancient compilers might treat a pointer as a signed value, thus we */
/* need a cast to unsigned word of each compared pointer. */
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__CHERI_PURE_CAPABILITY__)
# define GC_ADDR_LT(p, q) ((p) < (q))
#else
# define GC_ADDR_LT(p, q) ((GC_word)(p) < (GC_word)(q))
Expand Down

0 comments on commit 9ac83d6

Please sign in to comment.