In thinking about this thread and interpretation 1, I have noticed that much
of the discussion focusses on the last paragraph of the interpretation.
However I have become skeptical that this paragraph
"A common optimization for this fragment is to replace it by statements such
as 100, 130, etc. where the calculation of A + B appears in parenthesis.
This replacement corresponds to the calculation of A + B in a temporary
location (i.e., a register) and then accessing that temporary location
instead of storing the result in SUM and then accessing that stored value."
says anything significant. Note it says that inlining is a common
optimization, but it says nothing directly about whether it is always an
allowed operation or whether there are circumstances where it is not allowed.
>From the preceding paragraph
"The 'interpretation herein is that SUM is a primary (7.1.1.1) of the
expression 'SUM + C' and the reference to SUM requires its value (Section 6,
first paragraph). The determination of SUM's value was specified by
assignment statement 10. The result of that assignment, with its possible
conversions of 'A + B' to the type and type parameters of SUM, is the value
of SUM. This is the interpretation that must be fulfilled by conforming
processors."
I would argue that it is only allowed if the resulting value is the same as
that that would follow from the assignment (which is I believe Keith
Bierman's and James Giles's interpretation), but it seems that some members
of J3 interpret "A common optimization" as implying an allowed optimization.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|