Patch to allow Ada to work with tree-ssa

Andrew Haley aph@redhat.com
Tue Jun 22 19:49:00 GMT 2004


Richard Kenner writes:
 > > I somebody could point out what tree transformation is going wrong, I'll
 > > be glad to fix it.
 > 
 > It seems that something has changed the depth-first, left-to-right
 > parsing of expressions. Have you any idea what might have caused this?
 > 
 > "parsing"? Did you mean gimplifying?
Yes.
 > Indeed a number of things I did might have had the effect of
 > changing the order in which subtrees are gimplified. Since I
 > didn't think that anything depended on that, I didn't pay that much
 > attention to the issue. If there are places that do depend on
 > that, can you identify them so that comments can be placed in
 > gimplify.c saying what's order-dependent.
Java assumes that all expressions are fully evaluated in strict
left-to-right order. 
For example, in Java "a += a++ + a" is well-defined.
 > The changes would mostly relate to the order of gimplification of MODIFY_EXPR
 > and certain compound values, I'd guess.
 > 
 > Can you give an example of an expression that's handled differently?
Ranjit Mathew has reported that this breaks:
public class err6 {
 public static void main(String[] args) {
 int[] x = { 10, 11, 12, 1, 14 };
 int[] y = { 1, 2, 3, 4, 5, 6 };
 if ( x[(x=y)[2]] == 1 ) {
 System.out.println("OK");
 } else {
 System.out.println("NG:[1]-->[" +x[(x=y)[2]]+ "]");
 }
 }
}
The rule we're checking is that each dimension expression is fully
evaluated before any part of any dimension expression to its right.
So, this
 x[(x=y)[2]]
is gimplified as
 x1 = x
 x = y
 tmp = x1[2]
 x1[tmp]
I'll provide a more detailed diagnosis tomorrow. It's quite possible,
of course, that you've revealed a bug in the Java gimplification code.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /