From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gcc.c-torture/execute/20020508-2.c | 102 +++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20020508-2.c (limited to 'gcc/testsuite/gcc.c-torture/execute/20020508-2.c') diff --git a/gcc/testsuite/gcc.c-torture/execute/20020508-2.c b/gcc/testsuite/gcc.c-torture/execute/20020508-2.c new file mode 100644 index 000000000..533805a96 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20020508-2.c @@ -0,0 +1,102 @@ +#include + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0x1234) +#define SHORT_VALUE ((short)0x1234) +#define INT_VALUE ((int)0x1234) +#define LONG_VALUE ((long)0x12345678L) +#define LL_VALUE ((long long)0x12345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} -- cgit v1.2.3