view gcc/testsuite/c-c++-common/guality/Og-dce-3.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
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;
}