------- Comment #12 from hp at gcc dot gnu dot org 2008-05-09 19:18 ------- There has been some speculation that the back-ends where the bug appear are *all* to blame by e.g. having a flawed GO_IF_LEGITIMATE_ADDRESS. A gdb session shows that the back-end validation hook that is used for the (CONST (MINUS sym2 sym1)) expression is (naturally when you think of it) LEGITIMATE_CONSTANT_P. In cases similar to the failure for CRIS, the flawed expression isn't used in an address-operand so GO_IF_LEGITIMATE_ADDRESS won't hit.
But, consider the documentation, which recommends defining LEGITIMATE_CONSTANT_P to 1, which indeed most targets do; very few actually look inside a CONST, i386 being a notable exception. I think that kind of CONST should simply not be generated by gcc for now, and certainly not on the 4.3 branch. If this CONST *is* to be generated (on trunk), IMHO some new constant-expression validation needs to take place in CONSTANT_P, one where the target can refuse expressions that aren't valid assembly-code (in this case, for CRIS, sym2-sym1 where sym2 and sym1 are in different sections). Alternatively, LEGITIMATE_CONSTANT_P redefined in the documentation and most back-ends. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36182