NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/37943: posix_memalign doesn't work

>Number:         37943
>Category:       lib
>Synopsis:       posix_memalign doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 03 04:00:00 +0000 2008
>Originator:     Magnus Henoch
>Release:        NetBSD 4.99.42
System: NetBSD zemdatav 4.99.42 NetBSD 4.99.42 (IBOOK) #2: Fri Dec 14 09:47:51 
CET 2007 magnus@zemdatav:/media/e/netbsd/obj/sys/arch/macppc/compile/IBOOK 
Architecture: powerpc
Machine: macppc
        posix_memalign returns bogus addresses given certain
        combinations of alignment and size.

        (I encountered this while trying to build pkgsrc/devel/glib2)
        The following program reliably prints an address of 0x800 and
        segfaults when trying to access the memory:

#include <stdio.h>
#include <stdlib.h>

int main(void)
  char *a;
  int n;

  n = posix_memalign(&a, 128, 256);
  if (n)
    printf("posix_memalign(&a, 128, 256): %p\n", a);
  *a = 'a';

  return 0;



Home | Main Index | Thread Index | Old Index