2010-11-25 21:24:35 +00:00
// RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s
2009-06-11 20:48:09 +00:00
// PR 4349
union reg
{
unsigned char b [ 2 ] [ 2 ] ;
unsigned short w [ 2 ] ;
unsigned int d ;
} ;
struct cpu
{
union reg pc ;
} ;
extern struct cpu cpu ;
struct svar
{
void * ptr ;
} ;
2011-01-14 17:01:20 +00:00
// CHECK: @svars1 = unnamed_addr global [1 x %struct.svar] [%struct.svar { i8* bitcast (%struct.cpu* @cpu to i8*) }]
2009-06-11 20:48:09 +00:00
struct svar svars1 [ ] =
{
{ & ( ( cpu . pc ) . w [ 0 ] ) }
} ;
2011-01-14 17:01:20 +00:00
// CHECK: @svars2 = unnamed_addr 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) }]
2009-06-11 20:48:09 +00:00
struct svar svars2 [ ] =
{
{ & ( ( cpu . pc ) . b [ 0 ] [ 1 ] ) }
} ;
2011-01-14 17:01:20 +00:00
// CHECK: @svars3 = unnamed_addr 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*) }]
2009-06-11 20:48:09 +00:00
struct svar svars3 [ ] =
{
{ & ( ( cpu . pc ) . w [ 1 ] ) }
} ;
2011-01-14 17:01:20 +00:00
// CHECK: @svars4 = unnamed_addr 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) }]
2009-06-11 20:48:09 +00:00
struct svar svars4 [ ] =
{
{ & ( ( cpu . pc ) . b [ 1 ] [ 1 ] ) }
} ;