Changeset d83b266 for tests/polymorphism.cfa
- Timestamp:
- Jul 26, 2021, 2:42:34 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0a061c0
- Parents:
- c86ee4c (diff), 98233b3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/polymorphism.cfa
rc86ee4c rd83b266 54 54 b.i = s.i; 55 55 return b.j; 56 } 57 58 void checkPlan9offsets() { 59 60 forall( T ) 61 struct thing { 62 T q; // variable-sized padding 63 inline double; 64 inline float; 65 }; 66 67 #define SHOW_OFFSETS \ 68 double & x_inner_double = x; \ 69 float & x_inner_float = x; \ 70 printf(" offset of inner double: %ld\n", ((char *) & x_inner_double) - ((char *) & x) ); \ 71 printf(" offset of inner float: %ld\n", ((char *) & x_inner_float ) - ((char *) & x) ); 72 73 void showStatic( thing(long long int) & x ) { 74 printf("static:\n"); 75 SHOW_OFFSETS 76 } 77 78 forall( T ) 79 void showDynamic( thing(T) & x ) { 80 printf("dynamic:\n"); 81 SHOW_OFFSETS 82 } 83 84 #undef SHOW_OFFSETS 85 86 printf("=== checkPlan9offsets\n"); 87 thing(long long int) x; 88 showStatic(x); 89 showDynamic(x); 56 90 } 57 91 … … 114 148 assertf(ret == u.f2, "union operation fails in polymorphic context."); 115 149 } 150 151 checkPlan9offsets(); 116 152 } 117 153
Note:
See TracChangeset
for help on using the changeset viewer.