view gcc/testsuite/gcc.dg/guality/pr89463.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" } */

void __attribute__((noinline))
optimize_me_not ()
{
  __asm__ volatile ("" : : : "memory");
}
int a;
int main()
{
  int i;
  for (; a < 10; a++)
    i = 0;
  for (; i < 6; i++)
    ;
  /* i may very well be optimized out, so we cannot test for i == 6.
     Instead test i + 1 which will make the test UNSUPPORTED if i
     is optimized out.  Since the test previously had wrong debug
     with i == 0 this is acceptable.  Optimally we'd produce a
     debug stmt for the final value of the loop which would fix
     the UNSUPPORTED cases.  */
  optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "7" } } */
  return 0;
}