(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
stackalign/
alloca-1.c
       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  
      11  typedef int aligned __attribute__((aligned(ALIGNMENT)));
      12  
      13  int global;
      14  
      15  void
      16  bar (char *p, int size)
      17  {
      18    __builtin_strncpy (p, "good", size);
      19  }
      20  
      21  void
      22  foo (int size)
      23  {
      24    char *p = __builtin_alloca (size + 1);
      25    aligned i;
      26  
      27    bar (p, size);
      28    if (__builtin_strncmp (p, "good", size) != 0)
      29      {
      30  #ifdef DEBUG
      31        p[size] = '\0';
      32        printf ("Failed: %s != good\n", p);
      33  #endif
      34        abort ();
      35      }
      36  
      37    if (check_int (&i,  __alignof__(i)) != i)
      38      abort ();
      39  }
      40  
      41  int
      42  main()
      43  {
      44    foo (5);
      45    return 0;
      46  }