[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#186299: optimization/10315: [3.2/3.3 regression] [powerpc] ICE: in extract_insn, at recog.c:2175



>>>>> Geoff Keating writes:

> In that case, the RTL should never have been generated...

	The original C code appears to be buggy and GCC is not handling
the error very gracefully.  The C code is:

case 'f': {
        float v;

        memcpy(&v, &input[inputpos], sizeof(float));
        add_assoc_double(return_value, n, (double)v);

        break;
}

case 'd': {
        double v;

        memcpy(&v, &input[inputpos], sizeof(float));
        add_assoc_double(return_value, n, v);

        break;
}

Notice case 'd' memcpy uses sizeof(float), not sizeof(double).  GCC
inlines the memcpy(), but only half of "v" is set.
flow.c:initialize_uninitialized_subregs() simply jams in a zero in the
entry block for the function:

        insn = gen_move_insn (param.retval,
                              CONST0_RTX (GET_MODE (param.retval)));

	If I change sizeof(float) to sizeof(double) for case 'd', the
function compiles without error.  The sizeof(float) seems to be a typo, so
my first suggestion is fix the source code.

	GCC probably should not fall on its face when presented with this
type of error, but I am not sure who sure ensure a valid insn.
gen_move_insn() should not be called that late?

David



Reply to: