This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Do not use TYPE_CANONICAL in useless_type_conversion


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]