aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/static-order.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-01-04 02:08:04 +0000
committerAnders Carlsson <andersca@mac.com>2009-01-04 02:08:04 +0000
commitb723f7520bcce5f13ccaae557c16a1e7133b6908 (patch)
tree3797c27d14a598c9631f226d0c0dde78b9038db2 /test/CodeGen/static-order.c
parent5c5a7ee24270eb670881068d4baa2e2991f23214 (diff)
Fix the bug that would cause Python to crash at startup.
When emitting the static variables we need to make sure that the order is preserved. Fix this by making StaticDecls a std::list which has O(1) random removal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/static-order.c')
-rw-r--r--test/CodeGen/static-order.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c
new file mode 100644
index 0000000000..c63f4ed892
--- /dev/null
+++ b/test/CodeGen/static-order.c
@@ -0,0 +1,19 @@
+// RUN: clang -emit-llvm -o - %s | not grep "zeroinitializer"
+
+struct s {
+ int a;
+};
+
+static void *v;
+
+static struct s a;
+
+static struct s a = {
+ 10
+};
+
+void *f()
+{
+ if (a.a)
+ return v;
+}