Mercurial > hg > CbC > old > device
changeset 478:5e1acbe82483
struct alignment
author | kono |
---|---|
date | Thu, 10 Nov 2005 18:51:17 +0900 |
parents | 308192c08e0a |
children | 51c1b795b4f3 |
files | Changes mc-codegen.c |
diffstat | 2 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Thu Nov 10 14:33:49 2005 +0900 +++ b/Changes Thu Nov 10 18:51:17 2005 +0900 @@ -7241,4 +7241,29 @@ ia32 の emit_copy が無限ループ。 - +Thu Nov 10 18:46:39 JST 2005 + +ia32 のfloat drindirect のoffset + +構造体のalignmentをやってませんでした。 + +Unioon のdisp の計算、変じゃないか? + + } else if (mode==GUDECL||mode==LUDECL) { + // disp = ((disp+(size_of_int-1))&~(size_of_int-1)); + if (type>0 && car(type)==BIT_FIELD) { + cadr(caddr(type)) = 0; sz = size(cadr(type)); + } else { + sz = size(type); + } + fields = list4(type,fields,(int)(n->nm),0); + ^^^ disp じゃないの? + .... + + case GUDECL: case LUDECL: + if (disp < sz) disp = sz; + return n; + +と union だけdispが特別扱いのようですが... あんまりテストされてないなぁ。 + +
--- a/mc-codegen.c Thu Nov 10 14:33:49 2005 +0900 +++ b/mc-codegen.c Thu Nov 10 18:51:17 2005 +0900 @@ -2700,6 +2700,9 @@ #endif } else { sz = size(type); + if (sz%size_of_int==0) { + disp = ((disp+(size_of_int-1))&~(size_of_int-1)); + } } if (n!=&null_nptr) fields = list4(type,fields,(int)(n->nm),disp); @@ -2822,6 +2825,9 @@ nsc = car(ndsp); ndsp = cadr(ndsp); } else { + if (sz%size_of_int==0) { + disp = ((disp+(size_of_int-1))&~(size_of_int-1)); + } nsc = LVAR; ndsp = new_lvar(sz); }