This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not use TYPE_CANONICAL in useless_type_conversion
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Oct 2015 18:02:46 +0200
- Subject: Re: Do not use TYPE_CANONICAL in useless_type_conversion
- Authentication-results: sourceware.org; auth=none
- References: <20150930211235 dot GB30640 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1510011026010 dot 6516 at zhemvz dot fhfr dot qr> <20151002064333 dot GA7903 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1510020948540 dot 6516 at zhemvz dot fhfr dot qr>
> On Fri, 2 Oct 2015, Jan Hubicka wrote:
>
> > > There must be a reason why I allowed modes to differ there btw ;)
> >
> > Thinking about it, I guess reason is that incomplete types do not have
> > resonable modes set, so requiring modes to match will prevent complete
> > and incomplete types to match.
>
> Hmm. I still think that the mode shouldn't be relevant. Isn't this
> only about the cases where the aggregate ends up not having its address
> taken and thus we don't allocate a stack slot for it but end up
> using a register with mode? ISTR expansion has special cases dealing
> with some of the mismatch cases and a fallback spilling to the stack.
>
> I think we should fix that rather than disallowing aggregate assignments
> (which are memory ops to GIMPLE) based on the mode of the aggregate.
THe ICE we get is:
+===========================GNAT BUG DETECTED==============================+^M
| 6.0.0 20150929 (experimental) (powerpc64-unknown-linux-gnu) GCC error: |^M
| in convert_move, at expr.c:282 |^M
| Error detected around /home/jh/trunk/gcc/testsuite/gnat.dg/overriding_ops.ads:7:4|^M
| Please submit a bug report; see http://gcc.gnu.org/bugs.html. |^M
| Use a subject line meaningful to you and us to track the bug. |^M
| Include the entire contents of this bug box in the report. |^M
| Include the exact command that you entered. |^M
| Also include sources listed below. |^M
+==========================================================================+^M
which is:
void
convert_move (rtx to, rtx from, int unsignedp)
{
machine_mode to_mode = GET_MODE (to);
machine_mode from_mode = GET_MODE (from);
int to_real = SCALAR_FLOAT_MODE_P (to_mode);
int from_real = SCALAR_FLOAT_MODE_P (from_mode);
enum insn_code code;
rtx libcall;
/* rtx code for making an equivalent value. */
enum rtx_code equiv_code = (unsignedp < 0 ? UNKNOWN
: (unsignedp ? ZERO_EXTEND : SIGN_EXTEND));
gcc_assert (to_real == from_real);
gcc_assert (to_mode != BLKmode);
gcc_assert (from_mode != BLKmode);
so specifically we do not allow any RTL conversion from and to BLKmode and if
one of them is, we die. I guess it is because convert_move does not know size
of argument and does not expect it to be equivalent. We can fix this earlier
upstream when expanding assignment by adding appropriate subreg I think, but I
would rather do things step by step - first get with removal of TYPE_CANONICAL
and doing this second. I think one needs to fix expand_move and also probably an
expansion of calls/memory statemetns that also take loads/stores as parameters.
With TYPE_CANONICAL I think only case we get TYPE_CANONICAL equivalent for
aggregates of different mode would LTO and then we would ICE the same way here;
I guess no one tried to mix these Ada aggregates hard enough to trigger it.
Honza