PR go/61308
commitd9f3743a4d70e755a81c2782f7b1d847c4e7fa1b
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Aug 2014 02:58:15 +0000 (5 02:58 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Aug 2014 02:58:15 +0000 (5 02:58 +0000)
treefa207e6e1795c5257fbe25dc8ef6be5f219245e2
parentb8ca253e29bbac365dd28c574bfb14a7d7dc7f90
PR go/61308
PR go/61866

compiler: Don't cast index expr to int before bounds check.

This fixes http://gcc.gnu.org/PR61866 : on a 32-bit system,
casting an int64 index to int drops the upper 32 bits of the
value, and thus can cause an out-of-range index to appear to
be in range.

This undoes part of change 1318:fa6e0c716dba
(https://codereview.appspot.com/104610044) and therefore
breaks http://gcc.gnu.org/PR61308 again.  I have a separate
patch for that (http://codereview.appspot.com/122020043).  In
addition to undoing part of that change, this patch adds code
to avoid a compiler crash.  This changes PR61308 from a
compiler crash to an incorrect error message.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213616 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/expressions.cc