summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr43017.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/torture/pr43017.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/torture/pr43017.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr43017.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr43017.c b/gcc/testsuite/gcc.dg/torture/pr43017.c
new file mode 100644
index 000000000..257945290
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr43017.c
@@ -0,0 +1,99 @@
+/* { dg-do run } */
+/* { dg-options "-fwrapv" } */
+
+signed char foo(unsigned char c2)
+{
+ signed char c2_22;
+
+ if (c2 <= 63 || c2 == 127)
+ goto bb43;
+ else
+ goto bb20;
+
+bb20:
+ if (c2 > 252)
+ goto bb43;
+ else
+ goto bb21;
+
+bb21:
+ /*...*/;
+
+bb24:
+ c2_22 = (signed char)c2;
+ if (c2_22 >= 0)
+ goto bb25;
+ else
+ goto bb26;
+
+bb25:
+ c2 = (unsigned char)(c2_22 - 64);
+ goto bb27;
+
+bb26:
+ c2 = (unsigned char)(c2_22 - 65);
+
+bb27:
+ if (c2 <= 93)
+ goto bb28;
+ else
+ goto bb29;
+
+bb28:
+ c2 = c2 + 33;
+ goto bb30;
+
+bb29:
+ c2 = (unsigned char)((signed char)c2 - 61);
+
+bb30:
+ return c2;
+
+bb43:
+ return -1;
+}
+extern void abort (void);
+int main()
+{
+ signed char res[256] = {
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, 84, 85, 86, 87, 88,
+ 89, 90, 91, 92, 93, 94, 95, -1,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110, 111, 112, 113,
+ 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, -1, -1, -1
+ };
+ unsigned int c;
+ for (c = 0; c <= 255; ++c)
+ {
+ if (foo (c) != res[c])
+ abort ();
+ }
+ return 0;
+}