summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-19 05:36:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-19 05:36:41 +0000
commitb2f4cdb233b4d895e862835279faae1adf6047dd (patch)
treebe88235e94c81f5ca7258b4ec57c142603201528 /clang/test
parent3c50fdf4cad0c5842aafd5ea1237e83664730fc3 (diff)
downloadbcm5719-llvm-b2f4cdb233b4d895e862835279faae1adf6047dd.tar.gz
bcm5719-llvm-b2f4cdb233b4d895e862835279faae1adf6047dd.zip
Emission of global variable initialializer was broken in rare
situation where a tentative decl was emitted *after* the actual initialization. This occurs in some rare situations with static decls. - PR3613. - I'm not particularly happy with this fix, but I don't see a simpler or more elegant solution yet. llvm-svn: 65018
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/PR3613-static-decl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGen/PR3613-static-decl.c b/clang/test/CodeGen/PR3613-static-decl.c
new file mode 100644
index 00000000000..6dcaa183d3f
--- /dev/null
+++ b/clang/test/CodeGen/PR3613-static-decl.c
@@ -0,0 +1,16 @@
+// RUN: clang -triple i386-unknown-unknown -emit-llvm -o %t %s &&
+// RUN: grep '@g0 = internal global .struct.s0 <{ i32 3 }>' %t | count 1
+
+struct s0 {
+ int a;
+};
+
+static struct s0 g0;
+
+static int f0(void) {
+ return g0.a;
+}
+
+static struct s0 g0 = {3};
+
+void *g1 = f0;
OpenPOWER on IntegriCloud