summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/tmmti-2.C
blob: 808b5ab275dec4c2a9a7bf66afaeb1ef7a5fc2db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options { -O -fdump-tree-optimized } } */

int a[4][8];

int foo(long i)
{
	return *(&a[0][0] + i*8); // a[i][0]
}

struct Foo { double x, y; };

Foo b[4];

double bar(long i)
{
	return *(&b[0].x + i*2); // b[i].x
}

/* { dg-final { scan-tree-dump "a\\\[.*i.*\\\]\\\[0\\\]" "optimized" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump "b\\\[.*i.*\\\].x" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */