[Bug tree-optimization/83080] ICE at -Os and above with -Wall on C++ code: Segmentation fault

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 21 03:32:00 GMT 2017


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2017-11-21
                 CC|                            |msebor at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Introduced by my r254830.

The problem is that ELTSIZE is zero here:

      up_bound_p1 = int_const_binop (TRUNC_DIV_EXPR, maxbound, eltsize);

which makes int_const_binop() fail and return null.  The null up_bound_p1 is
then used below:

      tree arg = TREE_OPERAND (ref, 0);

      HOST_WIDE_INT off;
      if (get_addr_base_and_unit_offset (arg, &off))
        up_bound_p1 = wide_int_to_tree (sizetype,
                                        wi::sub (wi::to_wide (up_bound_p1),
                                                 off));

      up_bound_p1 = int_const_binop (TRUNC_DIV_EXPR, maxbound, eltsize);


More information about the Gcc-bugs mailing list