Skip to content

Commit

Permalink
Fix operand of size_t where capability is required gcc error on CHERI
Browse files Browse the repository at this point in the history
(fix of commit 9db2258)

Issue #627 (bdwgc).

* os_dep.c [MPROTECT_VDB && GC_ASSERTIONS] (IS_PAGE_ALIGNED): Do not
define.
* os_dep.c [MPROTECT_VDB] (GC_protect_heap): Expand
`IS_PAGE_ALIGNED(start)`; replace `IS_PAGE_ALIGNED(len)` to
`(len&(GC_page_size-1))==0`.
  • Loading branch information
ivmai committed Dec 20, 2024
1 parent 6fb2ed6 commit 3f40684
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3633,10 +3633,6 @@ GC_dirty_init(void)
}
# endif /* !DARWIN */

# ifdef GC_ASSERTIONS
# define IS_PAGE_ALIGNED(p) ((ADDR(p) & (GC_page_size - 1)) == 0)
# endif

STATIC void
GC_protect_heap(void)
{
Expand All @@ -3650,8 +3646,8 @@ GC_protect_heap(void)
struct hblk *current_start; /* start of block to be protected */
ptr_t limit;

GC_ASSERT(IS_PAGE_ALIGNED(start));
GC_ASSERT(IS_PAGE_ALIGNED(len));
GC_ASSERT((ADDR(start) & (GC_page_size - 1)) == 0);
GC_ASSERT((len & (GC_page_size - 1)) == 0);
# ifndef DONT_PROTECT_PTRFREE
/* We avoid protecting pointer-free objects unless the page */
/* size differs from HBLKSIZE. */
Expand Down

0 comments on commit 3f40684

Please sign in to comment.