summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/unsorted/i386bug.c
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
committerYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
commitbe8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch)
tree726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/gcc.c-torture/unsorted/i386bug.c
initial commit
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/unsorted/i386bug.c')
-rwxr-xr-xgcc/testsuite/gcc.c-torture/unsorted/i386bug.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/unsorted/i386bug.c b/gcc/testsuite/gcc.c-torture/unsorted/i386bug.c
new file mode 100755
index 0000000..395bfa6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/unsorted/i386bug.c
@@ -0,0 +1,51 @@
+typedef union {
+ struct {
+ long RH, LH;
+ } v;
+ struct {
+ unsigned char B1;
+ } u;
+} twohalves;
+
+
+typedef union {
+ long cint;
+ twohalves hhfield;
+
+} memoryword;
+
+
+extern memoryword mem[262];
+
+long znewstructure ( p )
+long p;
+{
+ long q, r;
+ {
+ q = mem [ p + 2 ] .hhfield .v.RH;
+ r = mem [ q + 1 ] .hhfield .v.LH;
+ do {
+ q = r;
+ r = mem [ r ] .hhfield .v.RH;
+ } while ( ! ( r == p ) );
+ r = foo((long) ( 3 ));
+ mem [ q ] .hhfield .v.RH = r;
+ mem [ r + 2 ] = mem [ p + 2 ];
+ if ( mem [ p + 2 ] .hhfield .v.LH == 0 )
+ {
+ q = mem [ p + 2 ] .hhfield .v.RH + 1;
+ while ( mem [ q ] .hhfield .v.RH != p ) q = mem [ q ] .hhfield .v.RH;
+ mem [ q ] .hhfield .v.RH = r;
+ }
+ }
+ mem [ r ] .hhfield .u.B1 = mem [ p ] .hhfield .u.B1;
+ mem [ r + 1 ] .hhfield .v.LH = p;
+
+ q = foo((long) ( 3 ));
+
+ mem [ r + 1 ] .hhfield .v.RH = q;
+ mem [ q + 2 ] .hhfield .v.RH = r;
+
+
+ return(r);
+}