https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97405

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rguenth at gcc dot gnu.org         |unassigned at gcc dot 
gnu.org
             Status|ASSIGNED                    |NEW
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, looks like the code expects

POLY_INT_CST [16, 16] /[ex] 16

to be constant folded - looks like poly_int_binop doesn't handle division
nor is there a wi::div_trunc for poly_wide_int.

This is generated here:

Breakpoint 5, copy_reference_ops_from_ref (ref=<array_ref 0x7ffff642fa10>, 
891                 /* But record element size in units of the type alignment. 
*/
892                 temp.op2 = TREE_OPERAND (ref, 3);
893                 temp.align = eltype->type_common.align;
894                 if (! temp.op2)
895                   temp.op2 = size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT
(eltype),
896                                          size_int (TYPE_ALIGN_UNIT
(eltype)));

Hmm, I see that temp.op2 is indeed always needed unless we want to disrupt
valueization.  copy_reference_ops_from_ref also isn't really allowed to fail.

So we absolutely need to be able to fold this EXACT/TRUNC_DIV_EXPR.

Richard?

Reply via email to