blob: 49c89e25fed4597c8e4126d0517056d6dd4085c8 [file] [log] [blame]
Duncan Sandsbb8f5902010-11-25 21:24:35 +00001// RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s
Dale Johannesen7512beb2009-06-11 20:48:09 +00002// PR 4349
3
4union reg
5{
6 unsigned char b[2][2];
7 unsigned short w[2];
8 unsigned int d;
9};
10struct cpu
11{
12 union reg pc;
13};
14extern struct cpu cpu;
15struct svar
16{
17 void *ptr;
18};
Bill Wendling7a6037c2011-06-02 22:11:49 +000019// CHECK: @svars1 = global [1 x %struct.svar] [%struct.svar { i8* bitcast (%struct.cpu* @cpu to i8*) }]
Dale Johannesen7512beb2009-06-11 20:48:09 +000020struct svar svars1[] =
21{
22 { &((cpu.pc).w[0]) }
23};
Bill Wendling7a6037c2011-06-02 22:11:49 +000024// CHECK: @svars2 = global [1 x %struct.svar] [%struct.svar { i8* getelementptr ([2 x i8]* bitcast (%struct.cpu* @cpu to [2 x i8]*), i{{[0-9]+}} 0, i{{[0-9]+}} 1) }]
Dale Johannesen7512beb2009-06-11 20:48:09 +000025struct svar svars2[] =
26{
27 { &((cpu.pc).b[0][1]) }
28};
Bill Wendling7a6037c2011-06-02 22:11:49 +000029// CHECK: @svars3 = global [1 x %struct.svar] [%struct.svar { i8* bitcast (i16* getelementptr ([2 x i16]* bitcast (%struct.cpu* @cpu to [2 x i16]*), i{{[0-9]+}} 0, i{{[0-9]+}} 1) to i8*) }]
Dale Johannesen7512beb2009-06-11 20:48:09 +000030struct svar svars3[] =
31{
32 { &((cpu.pc).w[1]) }
33};
Bill Wendling7a6037c2011-06-02 22:11:49 +000034// CHECK: @svars4 = global [1 x %struct.svar] [%struct.svar { i8* getelementptr ([2 x [2 x i8]]* bitcast (%struct.cpu* @cpu to [2 x [2 x i8]]*), i{{[0-9]+}} 0, i{{[0-9]+}} 1, i{{[0-9]+}} 1) }]
Dale Johannesen7512beb2009-06-11 20:48:09 +000035struct svar svars4[] =
36{
37 { &((cpu.pc).b[1][1]) }
38};