> On Dec 10, 2016, at 4:42 PM, Matt Wette <matt.we...@gmail.com> wrote: > > On Dec 10, 2016, at 9:11 AM, Daniel Llorens <daniel.llor...@bluewin.ch> wrote: >> >> >>>> Make check is failing on test-language, so I will be chasing that down. >> >> >> FWIW this is the only test that fails on 10.9.5 and the backtrace looks >> identical too. > > The problem appears in libguile/loader.c, alloc_aligned(). Check the value > of “ret” I get after malloc and after the alignment. I started looking at > type size for uintptr_t vs char* but then got confused why guile is being > compiled as x86_64, but my test programs are always x86 > > alignment=4096 > > /* This function leaks the memory that it allocates. */ > static char* > alloc_aligned (size_t len, unsigned alignment) > { > char *ret; > > if (alignment == 8) > { > /* FIXME: Assert that we actually have an 8-byte-aligned malloc. */ > ret = malloc (len); > } > #if defined(HAVE_SYS_MMAN_H) && defined(MMAP_ANONYMOUS) > else if (alignment == SCM_PAGE_SIZE) > { > ret = mmap (NULL, len, PROT_READ | PROT_WRITE, -1, 0); > if (ret == MAP_FAILED) > SCM_SYSERROR; > } > #endif > else > { > if (len + alignment < len) > abort (); > > ret = malloc (len + alignment - 1); > ret=0x0000000104000000 > if (!ret) > abort (); > ret = (char *) ALIGN ((scm_t_uintptr) ret, alignment); > ret=0x0000000004000000 > } > > return ret; > }
I posted a fix for this but wanted to respond in this thread. I added “(scm_t_uintptr)” cast before the argument “alignment” to ALIGN. Also, should MMAP_ANONYMOUS be HAVE_MAP_ANONYMOUS ???