OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [guality/] [vla-1.c] - Rev 689

Compare with Previous | Blame | View Log

/* PR debug/43150 */
/* { dg-do run } */
/* { dg-options "-g" } */
 
void __attribute__((noinline))
bar (short *p)
{
  __builtin_memset (p, '\0', 17 * sizeof (*p));
  asm volatile ("" : : "r" (p) : "memory");
}
 
int __attribute__((noinline))
f1 (int i)
{
  char a[i + 1];
  a[0] = 5;		/* { dg-final { gdb-test 17 "i" "5" } } */
  return a[0];		/* { dg-final { gdb-test 17 "sizeof (a)" "6" } } */
}
 
int __attribute__((noinline))
f2 (int i)
{
  short a[i * 2 + 7];	/* { dg-final { gdb-test 24 "i" "5" } } */
  bar (a);		/* { dg-final { gdb-test 24 "sizeof (a)" "17 * sizeof (short)" } } */
  return a[i + 4];
}
 
int
main ()
{
  volatile int j;
  int i = 5;
  asm volatile ("" : "=r" (i) : "0" (i));
  j = f1 (i);
  f2 (i);
  return 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.