aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c
new file mode 100644
index 000000000..bf62de568
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20020216-1.c
@@ -0,0 +1,24 @@
+/* PR c/3444
+ This used to fail because bitwise xor was improperly computed in char type
+ and sign extended to int type. */
+
+extern void abort ();
+extern void exit (int);
+
+signed char c = (signed char) 0xffffffff;
+
+int foo (void)
+{
+ return (unsigned short) c ^ (signed char) 0x99999999;
+}
+
+int main (void)
+{
+ if ((unsigned char) -1 != 0xff
+ || sizeof (short) != 2
+ || sizeof (int) != 4)
+ exit (0);
+ if (foo () != (int) 0xffff0066)
+ abort ();
+ exit (0);
+}