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
>Organization:
        
>Environment:
        
        
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 
macppc
Architecture: powerpc
Machine: macppc
>Description:
        posix_memalign returns bogus addresses given certain
        combinations of alignment and size.

        (I encountered this while trying to build pkgsrc/devel/glib2)
>How-To-Repeat:
        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)
    perror("posix_memalign");
  else
    printf("posix_memalign(&a, 128, 256): %p\n", a);
  *a = 'a';

  return 0;
}

>Fix:
        

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index