1 /* { dg-do run } */
2 /* { dg-options "-fno-tree-scev-cprop -fno-tree-vectorize -g" } */
3
4 #include "../nop.h"
5
6 void __attribute__((noipa,noinline))
7 foo (int n)
8 {
9 if (n == 0)
10 return;
11 int i = 0;
12 do
13 {
14 ++i; /* { dg-final { gdb-test . "i" "0" } } */
15 }
16 while (i < n);
17 /* The following works only with final value replacement or with the NOP
18 but not without (which means -Og). Vectorization breaks it, so disable
19 that. At -O3 it currently fails, PR89983. */
20 __asm__ volatile (NOP : : "g" (i) : "memory"); /* { dg-final { gdb-test . "i" "1" { xfail { aarch64*-*-* && { any-opts "-ftracer" } } } } } */
21 }
22 int main() { foo(1); }