summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr39240.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/pr39240.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/pr39240.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr39240.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39240.c b/gcc/testsuite/gcc.c-torture/execute/pr39240.c
new file mode 100644
index 000000000..de5e2ee70
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr39240.c
@@ -0,0 +1,105 @@
+/* PR target/39240 */
+
+extern void abort (void);
+
+__attribute__ ((noinline))
+static int foo1 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+unsigned int bar1 (int x)
+{
+ return foo1 (x + 6);
+}
+
+volatile unsigned long l1 = (unsigned int) -4;
+
+__attribute__ ((noinline))
+static short int foo2 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+unsigned short int bar2 (int x)
+{
+ return foo2 (x + 6);
+}
+
+volatile unsigned long l2 = (unsigned short int) -4;
+
+__attribute__ ((noinline))
+static signed char foo3 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+unsigned char bar3 (int x)
+{
+ return foo3 (x + 6);
+}
+
+volatile unsigned long l3 = (unsigned char) -4;
+
+__attribute__ ((noinline))
+static unsigned int foo4 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+int bar4 (int x)
+{
+ return foo4 (x + 6);
+}
+
+volatile unsigned long l4 = (int) -4;
+
+__attribute__ ((noinline))
+static unsigned short int foo5 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+short int bar5 (int x)
+{
+ return foo5 (x + 6);
+}
+
+volatile unsigned long l5 = (short int) -4;
+
+__attribute__ ((noinline))
+static unsigned char foo6 (int x)
+{
+ return x;
+}
+
+__attribute__ ((noinline))
+signed char bar6 (int x)
+{
+ return foo6 (x + 6);
+}
+
+volatile unsigned long l6 = (signed char) -4;
+
+int
+main (void)
+{
+ if (bar1 (-10) != l1)
+ abort ();
+ if (bar2 (-10) != l2)
+ abort ();
+ if (bar3 (-10) != l3)
+ abort ();
+ if (bar4 (-10) != l4)
+ abort ();
+ if (bar5 (-10) != l5)
+ abort ();
+ if (bar6 (-10) != l6)
+ abort ();
+ return 0;
+}