summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/20090907-1.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.c-torture/compile/20090907-1.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.c-torture/compile/20090907-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20090907-1.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/20090907-1.c b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c
new file mode 100644
index 000000000..907574c42
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20090907-1.c
@@ -0,0 +1,84 @@
+struct platform_device;
+typedef unsigned long __kernel_size_t;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef __kernel_size_t size_t;
+typedef __u32 uint32_t;
+static inline __attribute__ ((always_inline))
+uint32_t __attribute__ ((pure)) bfin_dspid (void)
+{
+ return ( {
+ uint32_t __v; __v;}
+ );
+}
+struct list_head {
+ struct list_head *next, *prev;
+};
+struct page {
+ union {
+ };
+ struct list_head lru;
+};
+struct device_driver {
+ const char *name;
+ struct module *owner;
+};
+struct fb_info {
+ struct device *dev;
+};
+struct platform_driver {
+ int (*probe) (struct platform_device *);
+ int (*remove) (struct platform_device *);
+ struct device_driver driver;
+};
+struct firmware {
+ size_t size;
+ const u8 *data;
+};
+struct metronomefb_par {
+ struct fb_info *info;
+};
+struct waveform_hdr {
+ u8 trc;
+};
+static u8 calc_cksum (int start, int end, u8 * mem)
+{
+ u8 tmp = 0;
+ int i;
+ for (i = start; i < end; i++)
+ tmp += mem[i];
+ return tmp;
+}
+extern struct waveform_hdr *wfm_hdr;
+extern int wmta;
+
+static int
+load_waveform (u8 * mem, size_t size, int m, int t, struct metronomefb_par *par)
+{
+ int tta;
+ int trn = 0;
+ int i;
+ u8 cksum;
+ int cksum_idx;
+ struct device *dev = par->info->dev;
+ for (i = 0; i <= sizeof (*wfm_hdr) + wfm_hdr->trc; i++) {
+ if (mem[i] > t) {
+ trn = i - sizeof (*wfm_hdr) - 1;
+ }
+ }
+ tta = * (mem + wmta + m * 4) & 0x00FFFFFF;
+ cksum_idx = tta + trn * 4 + 3;
+ cksum = calc_cksum (cksum_idx - 3, cksum_idx, mem);
+ if (cksum != mem[cksum_idx]) {
+ abort();
+ }
+}
+extern struct firmware *fw_entry;
+extern struct metronomefb_par *par;
+
+int metronomefb_probe (struct platform_device *dev)
+{
+ return load_waveform ((u8 *) fw_entry->data, fw_entry->size, 3, 31, par);
+}