>> It is wrong to assume that expressions are unequal because we cannot >> prove they are equal, with all the limitations that we currently >> have. This will introduce rejects-valid bugs. > In the PR at > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49638#c8 > I quote the standard: > > 4.5.7.3 (type-bound procedure overriding) has: > • Either both shall be subroutines or both shall be functions having the same > result characteristics (12.3.3). > > 12.3.3 (Characteristics of function results): > If a type parameter of a function result or a bound of a function result array > is not a constant expression, the > exact dependence on the entities in the expression is a characteristic > > > So the standards is more restrictive than expression values being the same. It > requires _the exact same dependence on the entities_. My reading of this is > that 3*(x+1) vs 3*x+3 is right to be rejected, same for (a+b)+c vs a+(b+c). > The only worrying case that I see is the one you pointed out: a+b+c vs c+b+a > (without brackets).
Huh, I don't see what is so different between 1) 3*(x+1) vs 3*x+3 and 2) a+b+c vs c+b+a In both cases the expressions look different at first sight, but can be transformed into each other mathematically. So I'd say they are mathematically equivalent, although the spelled-out representations of these expressions differ. The question is how you interpret the standard's formulation of "exact dependence on the entities in the expression". Naively I would have taken this to mean the *mathematical* dependence (which can be represented by different actual expressions). But I'm fine with your interpretation, too, which will make life even easier for us. Cheers, Janus