aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/pr90074.c
blob: 2fd884209f2666007a45b8df16025ab194d06aed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do run } */
/* { dg-options "-g" } */

void __attribute__((noinline))
optimize_me_not ()
{
  __asm__ volatile ("" : : : "memory");
}
char a;
short b[7][1];
int main()
{
  int i, c;
  a = 0;
  i = 0;
  for (; i < 7; i++) {
      c = 0;
      for (; c < 1; c++)
	b[i][c] = 0;
  }
  /* i may very well be optimized out, so we cannot test for i == 7.
     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 during loop distribution
     which would fix the UNSUPPORTED cases.
     c is optimized out at -Og for no obvious reason.  */
  optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
    /* { dg-final { gdb-test .-1 "c + 1" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */
  return 0;
}