view gcc/testsuite/gcc.dg/tree-ssa/calloc-1.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

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

extern int a;
extern int *b;
int n;
void* f(long *q)
{
  int *p = __builtin_malloc (n);
  ++*q;
  if (p)
  {
    ++*q;
    a = 2;
    __builtin_memset (p, 0, n);
    *b = 3;
  }
  return p;
}
void* g(void)
{
  float *p = __builtin_calloc (8, 4);
  return __builtin_memset (p, 0, 24); // not 32
}

/* { dg-final { scan-tree-dump-times "calloc" 2 "optimized" } } */
/* { dg-final { scan-tree-dump-not "malloc" "optimized" } } */
/* { dg-final { scan-tree-dump-not "memset" "optimized" } } */