summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/980526-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.c-torture/execute/980526-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.c-torture/execute/980526-2.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/980526-2.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/980526-2.c b/gcc/testsuite/gcc.c-torture/execute/980526-2.c
new file mode 100644
index 000000000..c17f4ea6d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/980526-2.c
@@ -0,0 +1,57 @@
+typedef unsigned int dev_t;
+typedef unsigned int kdev_t;
+
+static inline kdev_t to_kdev_t(int dev)
+{
+ int major, minor;
+
+ if (sizeof(kdev_t) == 16)
+ return (kdev_t)dev;
+ major = (dev >> 8);
+ minor = (dev & 0xff);
+ return ((( major ) << 22 ) | ( minor )) ;
+
+}
+
+void do_mknod(const char * filename, int mode, kdev_t dev)
+{
+ if (dev==0x15800078)
+ exit(0);
+ else
+ abort();
+}
+
+
+char * getname(const char * filename)
+{
+ register unsigned int a1,a2,a3,a4,a5,a6,a7,a8,a9;
+ a1 = (unsigned int)(filename) *5 + 1;
+ a2 = (unsigned int)(filename) *6 + 2;
+ a3 = (unsigned int)(filename) *7 + 3;
+ a4 = (unsigned int)(filename) *8 + 4;
+ a5 = (unsigned int)(filename) *9 + 5;
+ a6 = (unsigned int)(filename) *10 + 5;
+ a7 = (unsigned int)(filename) *11 + 5;
+ a8 = (unsigned int)(filename) *12 + 5;
+ a9 = (unsigned int)(filename) *13 + 5;
+ return (char *)(a1*a2+a3*a4+a5*a6+a7*a8+a9);
+}
+
+int sys_mknod(const char * filename, int mode, dev_t dev)
+{
+ int error;
+ char * tmp;
+
+ tmp = getname(filename);
+ error = ((long)( tmp )) ;
+ do_mknod(tmp,mode,to_kdev_t(dev));
+ return error;
+}
+
+int main(void)
+{
+ if (sizeof (int) != 4)
+ exit (0);
+
+ return sys_mknod("test",1,0x12345678);
+}