Hi Devang, > Use appropriate alignment while handling packed struct member.
the reason I asked for a testcase is that I thought all objects created by the IR we generate (whether locals, globals or on the heap) were supposed to be aligned at least as much as the gcc alignment. If so, the fact that we create a packed struct type (alignment 1) shouldn't make the gcc object alignment info in expr_align wrong, in fact it should be irrelevant. My fear is that your change might only be papering over the problem. > bool isVolatile = TREE_THIS_VOLATILE(exp); > const Type *Ty = ConvertType(TREE_TYPE(exp)); > unsigned Alignment = expr_align(exp) / 8; > + if (TREE_CODE(exp) == COMPONENT_REF) > + if (const StructType *STy = > + dyn_cast<StructType>(ConvertType(TREE_TYPE(TREE_OPERAND(exp, > 0))))) + if (STy->isPacked()) > + // Packed struct members use 1 byte alignment > + Alignment = 1; > + > Best wishes, Duncan. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits