summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pragma-align-2.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/pragma-align-2.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/pragma-align-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/pragma-align-2.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pragma-align-2.c b/gcc/testsuite/gcc.dg/pragma-align-2.c
new file mode 100644
index 000000000..ac5858cab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-align-2.c
@@ -0,0 +1,66 @@
+/* { dg-do run { target *-*-solaris2.* } } */
+
+void abort (void);
+
+#pragma align 1(x1)
+#pragma align 2(x2)
+#pragma align 4(x4)
+#pragma align 8(x8,y8,z8)
+#pragma align 16(x16)
+#pragma align 32(x32)
+#pragma align 64(x64)
+#pragma align 128(x128)
+
+#define MACRO 128
+#define MACRO2(A) A
+
+#pragma align MACRO(y128)
+#pragma align MACRO2(MACRO) (z128)
+
+#pragma align 8(not_defined)
+
+#pragma align 9(odd_align) /* { dg-warning "invalid alignment" } */
+#pragma align 256(high_align) /* { dg-warning "invalid alignment" } */
+#pragma align -1(neg_align) /* { dg-warning "malformed" } */
+#pragma align bad_align /* { dg-warning "malformed" } */
+#pragma align 1(bad_align /* { dg-warning "malformed" } */
+
+int x, x1, x2, x4, x8, y8, z8, x16, x32, x64, x128, y128, z128;
+
+#pragma align 16(x) /* { dg-warning "must appear before" } */
+
+int
+main ()
+{
+ if (__alignof__ (x4) < 4)
+ abort ();
+
+ if (__alignof__ (x8) < 8)
+ abort ();
+
+ if (__alignof__ (y8) < 8)
+ abort ();
+
+ if (__alignof__ (z8) < 8)
+ abort ();
+
+ if (__alignof__ (x16) < 16)
+ abort ();
+
+ if (__alignof__ (x32) < 32)
+ abort ();
+
+ if (__alignof__ (x64) < 64)
+ abort ();
+
+ if (__alignof__ (x128) < 128)
+ abort ();
+
+ if (__alignof__ (y128) < 128)
+ abort ();
+
+ if (__alignof__ (z128) < 128)
+ abort ();
+
+ return 0;
+}