comparison ir/irtypestruct.cpp @ 1351:8d501abecd24

Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Thu, 14 May 2009 17:20:17 +0200
parents 0c03ba6f7c24
children 2292878925f4
comparison
equal deleted inserted replaced
1350:15e9762bb620 1351:8d501abecd24
6 6
7 #include "gen/irstate.h" 7 #include "gen/irstate.h"
8 #include "gen/tollvm.h" 8 #include "gen/tollvm.h"
9 #include "gen/logger.h" 9 #include "gen/logger.h"
10 #include "gen/utils.h" 10 #include "gen/utils.h"
11 #include "gen/llvmhelpers.h"
11 #include "ir/irtypestruct.h" 12 #include "ir/irtypestruct.h"
12 13
13 ////////////////////////////////////////////////////////////////////////////// 14 //////////////////////////////////////////////////////////////////////////////
14 ////////////////////////////////////////////////////////////////////////////// 15 //////////////////////////////////////////////////////////////////////////////
15 ////////////////////////////////////////////////////////////////////////////// 16 //////////////////////////////////////////////////////////////////////////////
190 191
191 // get next aligned offset for this type 192 // get next aligned offset for this type
192 size_t alignedoffset = offset; 193 size_t alignedoffset = offset;
193 if (!packed) 194 if (!packed)
194 { 195 {
195 size_t alignsize = vd->type->alignsize(); 196 alignedoffset = realignOffset(alignedoffset, vd->type);
196 alignedoffset = (offset + alignsize - 1) & ~(alignsize - 1);
197 } 197 }
198 198
199 // insert explicit padding? 199 // insert explicit padding?
200 if (alignedoffset < vd->offset) 200 if (alignedoffset < vd->offset)
201 { 201 {