The following function segfaults when compiled at opt-level 2 or 3: ```rust fn segfaults() -> usize { core::iter::repeat(()).take(1).take(1).count() } ``` [The Compiler Explorer output is here.](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:rust,selection:(endColumn:1,endLineNumber:4,positionColumn:1,positionLineNumber:4,selectionStartColumn:1,selectionStartLineNumber:4,startColumn:1,startLineNumber:4),source:'pub+fn+segfaults()+-%3E+usize+%7B%0A++++core::iter::repeat(()).take(1).take(1).count()%0A%7D%0A'),l:'5',n:'0',o:'Rust+source+%231',t:'0')),k:44.90145672664954,l:'4',m:100,n:'0',o:'',s:0,t:'0'),(g:!((g:!((h:compiler,i:(compiler:rustccggcc-master,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:rust,libs:!(),options:'-C+opt-level%3D2',selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1,tree:'1'),l:'5',n:'0',o:'rustccggcc-master+(Rust,+Editor+%231,+Compiler+%231)',t:'0')),header:(),k:50.26748439078569,l:'4',m:68.69281045751634,n:'0',o:'',s:0,t:'0'),(g:!((h:output,i:(compiler:1,editor:1,fontScale:10,fontUsePx:'0',wrap:'1'),l:'5',n:'0',o:'Output+of+rustccggcc-master+(Compiler+%231)',t:'0')),header:(),l:'4',m:31.30718954248366,n:'0',o:'',s:0,t:'0')),k:55.09854327335048,l:'3',n:'0',o:'',t:'0')),l:'2',n:'0',o:'',t:'0')),version:4) You can see it produces this very strange line of assembly at the beginning of the function: ```asm mov rdx, QWORD PTR ds:0 ``` GDB confirms that this is where the segfault occurs.