aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr25125.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr25125.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr25125.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr25125.c b/gcc/testsuite/gcc.c-torture/execute/pr25125.c
new file mode 100644
index 00000000000..f08ebe74a48
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr25125.c
@@ -0,0 +1,27 @@
+extern void exit (int);
+extern void abort (void);
+extern unsigned short f (short a) __attribute__((__noinline__));
+
+unsigned short
+f (short a)
+{
+ short b;
+
+ if (a > 0)
+ return 0;
+ b = ((int) a) + - (int) 32768;
+ return b;
+}
+
+int
+main (void)
+{
+ if (sizeof (short) < 2
+ || sizeof (short) >= sizeof (int))
+ exit (0);
+
+ if (f (-32767) != 1)
+ abort ();
+
+ exit (0);
+}