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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Because of

#0  adjust_address_1 (memref=0x7ffff71e8db0, mode=E_HImode, offset=..., 
    validate=1, adjust_address=1, adjust_object=1, size=...)
    at /space/rguenther/src/gcc/gcc/emit-rtl.cc:2409
#1  0x00000000011459af in narrow_bit_field_mem (mem=0x7ffff71e8db0, 
    mode=HImode, bitsize=2, bitnum=7, new_bitnum=0x7fffffffc8c0)
    at /space/rguenther/src/gcc/gcc/expmed.cc:453
#2  0x0000000001145d1c in adjust_bit_field_mem_for_reg (pattern=EP_insv, 
    op0=0x7ffff71e8db0, bitsize=2, bitnum=7, bitregion_start=..., 
    bitregion_end=..., fieldmode=E_VOIDmode, new_bitnum=0x7fffffffc8c0)
    at /space/rguenther/src/gcc/gcc/expmed.cc:511
#3  0x00000000011483bb in store_integral_bit_field (op0=0x7ffff71e8db0, 
    op0_mode=SImode, bitsize=2, bitnum=7, bitregion_start=..., 
    bitregion_end=..., fieldmode=E_VOIDmode, value=0x7ffff70124a0, 
    reverse=false, fallback_p=true)
    at /space/rguenther/src/gcc/gcc/expmed.cc:1086
#4  0x00000000011476a0 in store_bit_field_1 (str_rtx=0x7ffff71e8db0, 
    bitsize=..., bitnum=..., bitregion_start=..., bitregion_end=..., 
    fieldmode=E_VOIDmode, value=0x7ffff70124a0, reverse=false, 
    fallback_p=true, undefined_p=false)
    at /space/rguenther/src/gcc/gcc/expmed.cc:887
#5  0x0000000001148c31 in store_bit_field (str_rtx=0x7ffff71e8db0, 
    bitsize=..., bitnum=..., bitregion_start=..., bitregion_end=..., 
    fieldmode=E_VOIDmode, value=0x7ffff70124a0, reverse=false, 
--Type <RET> for more, q to quit, c to continue without paging--
    ) at /space/rguenther/src/gcc/gcc/expmed.cc:1194
#6  0x000000000117dde0 in store_field (target=0x7ffff71e8db0, bitsize=..., 
    bitpos=..., bitregion_start=..., bitregion_end=..., mode=E_VOIDmode, 
    exp=<integer_cst 0x7ffff71c4ca8>, alias_set=1, nontemporal=false, 
    reverse=false) at /space/rguenther/src/gcc/gcc/expr.cc:8245
#7  0x0000000001174b21 in expand_assignment (
    to=<component_ref 0x7ffff71e07b0>, from=<integer_cst 0x7ffff71c4ca8>, 
    nontemporal=false) at /space/rguenther/src/gcc/gcc/expr.cc:6303

and we run into

  if (maybe_ne (size, 0))
    {
      /* Drop the object if the new right end is not within its bounds.  */
      if (adjust_object && maybe_gt (offset + size, attrs.size))
        {
          attrs.expr = NULL_TREE;
          attrs.alias = 0;
        }

as attrs.size is originally 1 and we are creating a two byte HImode access.

IMHO it's the fault of how we set up the initial memory attributes which
come via expand_assignment doing

      tem = get_inner_reference (to, &bitsize, &bitpos, &offset, &mode1,
                                 &unsignedp, &reversep, &volatilep);
..
      if (TREE_CODE (to) == COMPONENT_REF
          && DECL_BIT_FIELD_TYPE (TREE_OPERAND (to, 1)))
        get_bit_range (&bitregion_start, &bitregion_end, to, &bitpos, &offset);
..
      to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
..
          if (MEM_P (to_rtx))
            {
              /* If the field is at offset zero, we could have been given the
                 DECL_RTX of the parent struct.  Don't munge it.  */
              to_rtx = shallow_copy_rtx (to_rtx);
              set_mem_attributes_minus_bitpos (to_rtx, to, 0, bitpos);
              if (volatilep)
                MEM_VOLATILE_P (to_rtx) = 1;

that's an unfortunate setup to eventually widen the setup.

RTL alias analysis then has to rely on find_base_term to perform it's
bogus optimistic points-to analysis.

Reply via email to