This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Libjava failures status
Bryce McKinlay wrote:
>
> The only danger, afaik, is if an instruction that can throw (pointer
> dereference or integer divide) would be seen to have no other
> side-effects and is removed or reordered across other instructions that
> do have side effects. But, I think its fairly unlikely that real code
> would care since the NullPointerException/ArithmeticException are there
> to catch programming errors and its bad style to use them for actual
> flow control. When such exceptions occur the side effects of other
> nearby instructions would almost certainly be ignored by the users code.
Typical user code may not care, but the Java Language Specification
requires that exceptions be precise enough for use as flow control (as
undesirable as this is). JLS 11.3.1 makes it clear that synchronous
exceptions cannot appear to take place out of order with nearby
expressions with side effects. There are even examples in the JLS of
this: JLS 15.9.6 has a program which purposefully catches an
OutOfMemoryError to demonstrate where the exception occurs in relation
to the other side effects.
--
This signature intentionally left boring.
Eric Blake ebb9@email.byu.edu
BYU student, free software programmer