On Sun, Jan 14, 2018 at 06:29:54AM -0800, H.J. Lu wrote: > + if (TREE_CODE (field) == FIELD_DECL && DECL_PACKED (field)) > + { > + tree field_type = TREE_TYPE (field); > + unsigned int type_align = TYPE_ALIGN (field_type); > + tree context = DECL_CONTEXT (field); > + unsigned int record_align = TYPE_ALIGN (context); > + if ((record_align % type_align) != 0) > + return context; > + type_align /= BITS_PER_UNIT; > + unsigned HOST_WIDE_INT field_off > + = (tree_to_uhwi (DECL_FIELD_OFFSET (field)) > + + (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (field)) > + / BITS_PER_UNIT));
This has the same bug I've just created PR83844 for, you can't assume DECL_FIELD_OFFSET is INTEGER_CST that fits into UHWI, and also we have byte_position wrapper that should be used to compute the offset from DECL_FIELD_*OFFSET. Jakub