summaryrefslogtreecommitdiffstats
path: root/test/FrontendC
diff options
context:
space:
mode:
Diffstat (limited to 'test/FrontendC')
-rw-r--r--test/FrontendC/2010-06-28-DbgEntryPC.c50
-rw-r--r--test/FrontendC/2010-07-14-overconservative-align.c14
-rw-r--r--test/FrontendC/2010-07-14-ref-off-end.c27
-rw-r--r--test/FrontendC/vla-1.c8
4 files changed, 49 insertions, 50 deletions
diff --git a/test/FrontendC/2010-06-28-DbgEntryPC.c b/test/FrontendC/2010-06-28-DbgEntryPC.c
deleted file mode 100644
index 76a6b51..0000000
--- a/test/FrontendC/2010-06-28-DbgEntryPC.c
+++ /dev/null
@@ -1,50 +0,0 @@
-// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -mtriple=i386-apple-darwin | FileCheck %s
-// Use DW_FORM_addr for DW_AT_entry_pc.
-// Radar 8094785
-
-// XFAIL: *
-// XTARGET: x86,i386,i686
-// CHECK: .byte 17 ## DW_TAG_compile_unit
-// CHECK-NEXT: .byte 1 ## DW_CHILDREN_yes
-// CHECK-NEXT: .byte 37 ## DW_AT_producer
-// CHECK-NEXT: .byte 8 ## DW_FORM_string
-// CHECK-NEXT: .byte 19 ## DW_AT_language
-// CHECK-NEXT: .byte 11 ## DW_FORM_data1
-// CHECK-NEXT: .byte 3 ## DW_AT_name
-// CHECK-NEXT: .byte 8 ## DW_FORM_string
-// CHECK-NEXT: .byte 82 ## DW_AT_entry_pc
-// CHECK-NEXT: .byte 1 ## DW_FORM_addr
-// CHECK-NEXT: .byte 16 ## DW_AT_stmt_list
-// CHECK-NEXT: .byte 6 ## DW_FORM_data4
-// CHECK-NEXT: .byte 27 ## DW_AT_comp_dir
-// CHECK-NEXT: .byte 8 ## DW_FORM_string
-// CHECK-NEXT: .byte 225 ## DW_AT_APPLE_optimized
-
-struct a {
- int c;
- struct a *d;
-};
-
-int ret;
-
-void foo(int x) __attribute__((noinline));
-void *bar(struct a *b) __attribute__((noinline));
-
-void foo(int x)
-{
- ret = x;
-}
-
-void *bar(struct a *b) {
- foo(b->c);
- return b;
-}
-
-int main(int argc, char *argv[]) {
- struct a e;
- e.c = 4;
- e.d = &e;
-
- (void)bar(&e);
- return ret;
-}
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 0000000..65fbdb8
--- /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 0000000..6ccd05b
--- /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);
+}
diff --git a/test/FrontendC/vla-1.c b/test/FrontendC/vla-1.c
new file mode 100644
index 0000000..76f6c53
--- /dev/null
+++ b/test/FrontendC/vla-1.c
@@ -0,0 +1,8 @@
+// RUN: true
+// %llvmgcc -std=gnu99 %s -S |& grep {error: "is greater than the stack alignment" }
+
+int foo(int a)
+{
+ int var[a] __attribute__((__aligned__(32)));
+ return 4;
+}
OpenPOWER on IntegriCloud