https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79649
Bug ID: 79649 Summary: Memset pattern in named address space crashes compiler or generates wrong code Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: me at manueljacob dot de CC: amker at gcc dot gnu.org, rguenth at gcc dot gnu.org Target Milestone: --- Created attachment 40787 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40787&action=edit GCC error output This happens at least on x86-64 with -O3. If I pass code like this, void memset_pattern_seg_gs(unsigned char __seg_gs *s, long n) { for (long i = 0; i < n; ++i) s[i] = 0; } the compiler crashes with "internal compiler error: in clear_storage_hints" (full traceback attached). If I change the loop body to set 1 instead of 0, the compiler emits a call to memset, which is wrong because it will write to the wrong address space.