> > Note that I had to make a few changes (fixes?) in the MI portions of > > gcc to avoid problems I encountered, I don't know if these changes are > > "correct" or if there are better ways to avoid those cases. Those > > In any case, they should best be posted in separate messages, each one > with its own rationale.
Here's the first of those... The patch assumes that, "by definition", a partial int mode has fewer bits than an int mode of the same size, and thus truncation should be used to go from the int mode to the partial int mode. Index: gcc/cfgexpand.c =================================================================== --- gcc/cfgexpand.c (revision 198591) +++ gcc/cfgexpand.c (working copy) @@ -3090,13 +3090,17 @@ expand_debug_expr (tree exp) size_t, we need to check for mis-matched modes and correct the addend. */ if (op0 && op1 && GET_MODE (op0) != VOIDmode && GET_MODE (op1) != VOIDmode && GET_MODE (op0) != GET_MODE (op1)) { - if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1))) + if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1)) + /* Don't try to sign-extend SImode to PSImode, for example. */ + || (GET_MODE_BITSIZE (GET_MODE (op0)) == GET_MODE_BITSIZE (GET_MODE (op1)) + && GET_MODE_CLASS (GET_MODE (op0)) == MODE_PARTIAL_INT + && GET_MODE_CLASS (GET_MODE (op1)) == MODE_INT)) op1 = simplify_gen_unary (TRUNCATE, GET_MODE (op0), op1, GET_MODE (op1)); else /* We always sign-extend, regardless of the signedness of the operand, because the operand is always unsigned here even if the original C expression is signed. */