summaryrefslogtreecommitdiff
path: root/test/FrontendC
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-07-14 21:22:35 +0000
committerDale Johannesen <dalej@apple.com>2010-07-14 21:22:35 +0000
commitbe876e3a90eef801297a1e6584e08a7d9c95b7aa (patch)
treee2fd0b980c5f64e1f4cff42f4ce8b25e7200a4b9 /test/FrontendC
parent79b78a43ece977899b654fe3c19d0c94f963c128 (diff)
downloadllvm-be876e3a90eef801297a1e6584e08a7d9c95b7aa.tar.gz
llvm-be876e3a90eef801297a1e6584e08a7d9c95b7aa.tar.bz2
llvm-be876e3a90eef801297a1e6584e08a7d9c95b7aa.tar.xz
Tests for llvm-gcc commit 108360.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FrontendC')
-rw-r--r--test/FrontendC/2010-07-14-overconservative-align.c14
-rw-r--r--test/FrontendC/2010-07-14-ref-off-end.c27
2 files changed, 41 insertions, 0 deletions
diff --git a/test/FrontendC/2010-07-14-overconservative-align.c b/test/FrontendC/2010-07-14-overconservative-align.c
new file mode 100644
index 0000000000..65fbdb8300
--- /dev/null
+++ b/test/FrontendC/2010-07-14-overconservative-align.c
@@ -0,0 +1,14 @@
+// RUN: %llvmgcc %s -emit-llvm -m64 -S -o - | FileCheck %s
+// PR 5995
+struct s {
+ int word;
+ struct {
+ int filler __attribute__ ((aligned (8)));
+ };
+};
+
+void func (struct s *s)
+{
+// CHECK: load %struct.s** %s_addr, align 8
+ s->word = 0;
+}
diff --git a/test/FrontendC/2010-07-14-ref-off-end.c b/test/FrontendC/2010-07-14-ref-off-end.c
new file mode 100644
index 0000000000..6ccd05b770
--- /dev/null
+++ b/test/FrontendC/2010-07-14-ref-off-end.c
@@ -0,0 +1,27 @@
+// RUN: %llvmgcc %s -S -m32 -o - | FileCheck %s
+// Formerly this generated code that did a load past the end of the structure.
+// That was fixed by 46726, but that patch had bad side effects and was
+// reverted. This has been fixed another way in the meantime.
+extern void abort();
+extern void exit(int);
+struct T
+{
+unsigned i:8;
+unsigned c:24;
+};
+f(struct T t)
+{
+struct T s[1];
+s[0]=t;
+return(char)s->c;
+}
+main()
+{
+// CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0 ; <i32*> [#uses=2]
+// CHECK: getelementptr inbounds %struct.T* %t, i32 0, i32 0 ; <i32*> [#uses=2]
+struct T t;
+t.i=0xff;
+t.c=0xffff11;
+if(f(t)!=0x11)abort();
+exit(0);
+}