https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79085
Bug ID: 79085 Summary: ICE with placement new to unaligned location Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thopre01 at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- Created attachment 40517 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40517&action=edit Placement new to unaligned location Hi, The attached file ICE when compiled with -Os. The ICE is due to the assert in assign_temp when called from expand_call because TREE_ADDRESSABLE(type) is true. This is set from the C++ frontend in finish_struct_bits because there is a non default constructor and expand_call calls assign_temp because the location in which the return value optimization is not sufficiently aligned. Due to the check to SLOW_UNALIGNED_ACCESS in expand_call, this does not affect all targets. I was able to reproduce the bug can be reproduced on alpha-linux-gnu by adapting size_t and ptrdiff_t accordingly. Setting the component to C++ based on the comment regarding the assertion of TREE_ADDRESSABLE in assign_temp.