<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
bounds-checking	B-Error_Name
elimination	I-Error_Name
is	O
a	O
compiler	B-Application
optimization	I-Application
useful	O
in	O
programming	O
languages	O
or	O
runtime	B-Device
systems	I-Device
that	O
enforce	O
bounds	B-Data_Structure
checking	I-Data_Structure
,	O
the	O
practice	O
of	O
checking	O
every	O
index	O
into	O
an	O
array	B-Data_Structure
to	O
verify	O
that	O
the	O
index	O
is	O
within	O
the	O
defined	O
valid	O
range	O
of	O
indexes	O
.	O
</s>
<s>
Its	O
goal	O
is	O
to	O
detect	O
which	O
of	O
these	O
indexing	O
operations	O
do	O
not	O
need	O
to	O
be	O
validated	O
at	B-Library
runtime	I-Library
,	O
and	O
eliminating	O
those	O
checks	O
.	O
</s>
<s>
One	O
common	O
example	O
is	O
accessing	O
an	O
array	B-Data_Structure
element	I-Data_Structure
,	O
modifying	O
it	O
,	O
and	O
storing	O
the	O
modified	O
value	O
in	O
the	O
same	O
array	B-Data_Structure
at	O
the	O
same	O
location	O
.	O
</s>
<s>
Normally	O
,	O
this	O
example	O
would	O
result	O
in	O
a	O
bounds	B-Data_Structure
check	I-Data_Structure
when	O
the	O
element	O
is	O
read	O
from	O
the	O
array	B-Data_Structure
and	O
a	O
second	O
bounds	B-Data_Structure
check	I-Data_Structure
when	O
the	O
modified	O
element	O
is	O
stored	O
using	O
the	O
same	O
array	B-Data_Structure
index	O
.	O
</s>
<s>
Bounds-checking	B-Error_Name
elimination	I-Error_Name
could	O
eliminate	O
the	O
second	O
check	O
if	O
the	O
compiler	O
or	O
runtime	B-Library
can	O
determine	O
that	O
neither	O
the	O
array	B-Data_Structure
size	O
nor	O
the	O
index	O
could	O
change	O
between	O
the	O
two	O
array	B-Data_Structure
operations	O
.	O
</s>
<s>
Another	O
example	O
occurs	O
when	O
a	O
programmer	O
loops	B-Algorithm
over	I-Algorithm
the	O
elements	O
of	O
the	O
array	B-Data_Structure
,	O
and	O
the	O
loop	O
condition	O
guarantees	O
that	O
the	O
index	O
is	O
within	O
the	O
bounds	O
of	O
the	O
array	B-Data_Structure
.	O
</s>
<s>
However	O
,	O
it	O
may	O
still	O
be	O
possible	O
for	O
the	O
compiler	O
or	O
runtime	B-Library
to	O
perform	O
proper	O
bounds-checking	B-Error_Name
elimination	I-Error_Name
in	O
this	O
case	O
.	O
</s>
<s>
One	O
technique	O
for	O
bounds-checking	B-Error_Name
elimination	I-Error_Name
is	O
to	O
use	O
a	O
typed	O
static	O
single	O
assignment	O
form	O
representation	O
and	O
for	O
each	O
array	B-Data_Structure
to	O
create	O
a	O
new	O
type	O
representing	O
a	O
safe	O
index	O
for	O
that	O
particular	O
array	B-Data_Structure
.	O
</s>
<s>
The	O
first	O
use	O
of	O
a	O
value	O
as	O
an	O
array	B-Data_Structure
index	O
results	O
in	O
a	O
runtime	B-Library
type	O
cast	O
(	O
and	O
appropriate	O
check	O
)	O
,	O
but	O
subsequently	O
the	O
safe	O
index	O
value	O
can	O
be	O
used	O
without	O
a	O
type	O
cast	O
,	O
without	O
sacrificing	O
correctness	O
or	O
safety	O
.	O
</s>
<s>
Just-in-time	O
compiled	O
languages	O
such	O
as	O
Java	B-Language
and	O
C#	B-Application
often	O
check	O
indexes	O
at	B-Library
runtime	I-Library
before	O
accessing	O
arrays	O
.	O
</s>
<s>
Some	O
just-in-time	O
compilers	O
such	O
as	O
HotSpot	B-Language
are	O
able	O
to	O
eliminate	O
some	O
of	O
these	O
checks	O
if	O
they	O
discover	O
that	O
the	O
index	O
is	O
always	O
within	O
the	O
correct	O
range	O
,	O
or	O
if	O
an	O
earlier	O
check	O
would	O
have	O
already	O
thrown	O
an	O
exception	O
.	O
</s>
