rename variables for clarity.
add test for structure alignment/offset.

R=gri
DELTA=49  (35 added, 0 deleted, 14 changed)
OCL=28068
CL=28068
diff --git a/src/lib/reflect/all_test.go b/src/lib/reflect/all_test.go
index 080a360..d193efd 100644
--- a/src/lib/reflect/all_test.go
+++ b/src/lib/reflect/all_test.go
@@ -6,7 +6,8 @@
 
 import (
 	"reflect";
-	"testing"
+	"testing";
+	"unsafe";
 )
 
 var doprint bool = false
@@ -472,3 +473,37 @@
 		t.Error("DeepEqual(complex different) = true, want false");
 	}
 }
+
+
+func check2ndField(x interface{}, offs uintptr, t *testing.T) {
+	s := reflect.NewValue(x).(reflect.StructValue);
+	name, ftype, tag, reflect_offset := s.Type().(reflect.StructType).Field(1);
+	if uintptr(reflect_offset) != offs {
+		t.Error("mismatched offsets in structure alignment:", reflect_offset, offs);
+	}
+}
+
+// Check that structure alignment & offsets viewed through reflect agree with those
+// from the compiler itself.
+func TestAlignment(t *testing.T) {
+	type T1inner struct {
+		a int
+	}
+	type T1 struct {
+		T1inner;
+		f int;
+	}
+	type T2inner struct {
+		a, b int
+	}
+	type T2 struct {
+		T2inner;
+		f int;
+	}
+
+	x := T1{T1inner{2}, 17};
+	check2ndField(x, uintptr(unsafe.Pointer(&x.f)) - uintptr(unsafe.Pointer(&x)), t);
+
+	x1 := T2{T2inner{2, 3}, 17};
+	check2ndField(x1, uintptr(unsafe.Pointer(&x1.f)) - uintptr(unsafe.Pointer(&x1)), t);
+}