1/* { dg-do run } */ 2/* { dg-skip-if "Stack alignment is too small" { hppa*-*-hpux* } "*" "" } */ 3/* { dg-require-effective-target alloca } */ 4 5#include "check.h" 6 7#ifndef ALIGNMENT 8#define ALIGNMENT 64 9#endif 10 11typedef int aligned __attribute__((aligned(ALIGNMENT))); 12 13int global; 14 15void 16bar (char *p, int size) 17{ 18 __builtin_strncpy (p, "good", size); 19} 20 21static void 22inline __attribute__((always_inline)) 23foo (int size) 24{ 25 char *p = __builtin_alloca (size + 1); 26 aligned i; 27 28 bar (p, size); 29 if (__builtin_strncmp (p, "good", size) != 0) 30 { 31#ifdef DEBUG 32 p[size] = '\0'; 33 printf ("Failed: %s != good\n", p); 34#endif 35 abort (); 36 } 37 38 if (check_int (&i, __alignof__(i)) != i) 39 abort (); 40} 41 42int 43main() 44{ 45 foo (5); 46 return 0; 47} 48