1  #include <stdio.h>
       2  #include <stdint.h>
       3  #include <stdlib.h>
       4  
       5  #ifndef ALIGN
       6  # define ALIGN 0x800000
       7  #endif
       8  
       9  int
      10  __attribute__ ((weak))
      11  is_aligned (void *p, int align)
      12  {
      13    return (((uintptr_t) p) & (align - 1)) == 0;
      14  }
      15  
      16  int foo __attribute__ ((aligned (ALIGN))) = 1;
      17  
      18  int
      19  main (void)
      20  {
      21    if (!is_aligned (&foo, ALIGN))
      22      abort ();
      23    printf ("PASS\n");
      24    return 0;
      25  }