<h2 dir="auto"><g-emoji class="g-emoji" alias="bug" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji> Bug</h2>
<h2 dir="auto">To Reproduce</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@torch.jit.script
def fn():
    a = [1, 2, 3, 4]
    return a[::-1]
fn()"><pre class="notranslate"><code class="notranslate">@torch.jit.script
def fn():
    a = [1, 2, 3, 4]
    return a[::-1]
fn()
</code></pre></div>
<blockquote>
<p dir="auto">RuntimeError: vector::_M_range_check The above operation failed in interpreter, with the following stack trace: at test/test_jit.py:6263:19<br>
@torch.jit.script<br>
def test():<br>
a = [1, 2, 3, 4]<br>
return a[::-1]<br>
~~~~~~ &lt;--- HERE</p>
</blockquote>
<p dir="auto">This should either give a compile error, or work (better), but it should not compile and be unsupported.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a></p>
<p dir="auto">For</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="def t():
    x = [1,2,3]
    x = x[::-1]
    print(x)

torch.jit.script(t)()"><pre class="notranslate"><code class="notranslate">def t():
    x = [1,2,3]
    x = x[::-1]
    print(x)

torch.jit.script(t)()
</code></pre></div>
<p dir="auto">it gives <code class="notranslate">IndexError: vector::_M_range_check: __n (which is 18446744073709551615) &gt;= this-&gt;size() (which is 3)</code></p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a></p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ezyang/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ezyang">@ezyang</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gchanan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gchanan">@gchanan</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zou3519/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zou3519">@zou3519</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bdhirsh/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/bdhirsh">@bdhirsh</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gmagogsfm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gmagogsfm">@gmagogsfm</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/suo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/suo">@suo</a></p>