[Bug middle-end/99641] [11 Regression] opt30.adb, opt49.adb and loop_optimization3.adb fail to build at m32

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 18 10:32:56 GMT 2021


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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ada                         |middle-end
   Target Milestone|---                         |11.0
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
The offset calculation in native_encode_initializer is incorrect:

              if (index && TREE_CODE (index) == RANGE_EXPR)
                {
                  if (!tree_fits_shwi_p (TREE_OPERAND (index, 0))
                      || !tree_fits_shwi_p (TREE_OPERAND (index, 1)))
                    return 0;
                  pos = (tree_to_shwi (TREE_OPERAND (index, 0)) - min_index)
                        * fieldsize;
                  count = (tree_to_shwi (TREE_OPERAND (index, 1))
                           - tree_to_shwi (TREE_OPERAND (index, 0)));
                }
              else if (index)
                {
                  if (!tree_fits_shwi_p (index))
                    return 0;
                  pos = (tree_to_shwi (index) - min_index) * fieldsize;
                }

It must not be done in HOST_WIDE_INT but in sizetype instead, like in e.g.
get_inner_reference or get_ref_base_and_extent.


More information about the Gcc-bugs mailing list