view gcc/testsuite/c-c++-common/guality/Og-dce-3.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-g" } */

volatile int amount = 10;

void __attribute__((noipa))
do_something (int *ptr)
{
  *ptr += 10;
}

int __attribute__((noipa))
foo (int count)
{
  int x = 1;
  for (int i = 0; i < count; ++i)
    do_something (&x); /* { dg-final { gdb-test . "x" "1" } } */
  int res = x; /* { dg-final { gdb-test . "x" "101" } } */
  x = res + 1;
  return res; /* { dg-final { gdb-test . "x" "102" } } */
  
}

int
main (void)
{
  foo (10);
  return 0;
}