view gcc/testsuite/gcc.dg/pr80020.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR middle-end/80020 - gcc confused about aligned_alloc argument order
   { dg-do compile }
   { dg-options "-O2 -Wall -fdump-tree-optimized" } */

void sink (void*);

void foo (void)
{
  enum {
    Align = 32,
    Size = 123
  };

  void *p = __builtin_aligned_alloc (Align, Size);
  unsigned n = __builtin_object_size (p, 0);

  if (n != Size)
    __builtin_abort ();

  __builtin___memset_chk (p, 0, Size, n);

  sink (p);
}

/* { dg-final { scan-tree-dump-not "abort" "optimized" } }
   { dg-final { scan-tree-dump-not "memset_chk" "optimized" } } */