From 7512beb75147e357dc4870f42d1088a27f65d1d2 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 11 Jun 2009 20:48:09 +0000 Subject: [PATCH] Test for rev 73205 (PR 4349) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73206 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/FrontendC/pr4349.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/FrontendC/pr4349.c diff --git a/test/FrontendC/pr4349.c b/test/FrontendC/pr4349.c new file mode 100644 index 00000000000..10ba9962f3f --- /dev/null +++ b/test/FrontendC/pr4349.c @@ -0,0 +1,39 @@ +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]} +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1 +// 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; +}; +struct svar svars1[] = +{ + { &((cpu.pc).w[0]) } +}; +struct svar svars2[] = +{ + { &((cpu.pc).b[0][1]) } +}; +struct svar svars3[] = +{ + { &((cpu.pc).w[1]) } +}; +struct svar svars4[] = +{ + { &((cpu.pc).b[1][1]) } +}; -- 2.34.1