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

            Bug ID: 78376
           Summary: invalid ARM 'ubfx' instruction generated
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
  Target Milestone: ---

When building a Linux kernel with arm-linux-gnueabi-gcc (GCC) 7.0.0 20161115, I
ran into an error from the assembler:

/tmp/cchIg3BB.s:589: Error: bit-field extends past end of register -- `ubfx
r0,r0,#29,#8'

This is the respective line in the assembler file:

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:281:   
priv->params.rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
        ubfx    r0, r0, #29, #8 @ MEM[(struct mlx5e_priv *)netdev_3(D) +
1568B].params.rx_am_enabled, _22,,

This is in the preprocessed source code:

 priv->params.rx_am_enabled = (((__u32)__builtin_bswap32((__u32)((
__u32)(__be32)(*((__be32 *)(mdev->hca_caps_cur[MLX5_CAP_GENERAL])
+(((unsigned)(unsigned long)(&(((struct mlx5_ifc_cmd_hca_cap_bits
*)0)->cq_moderation))) / 32))))) >> (32 - sizeof(((struct
mlx5_ifc_cmd_hca_cap_bits *)0)->cq_moderation) - (((unsigned)(unsigned
long)(&(((struct mlx5_ifc_cmd_hca_cap_bits *)0)->cq_moderation))) & 0x1f))) &
((u32)((1ull << sizeof(((struct mlx5_ifc_cmd_hca_cap_bits *)0)->cq_moderation))
- 1)));

and for completeness this is in the original source:
#define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) -
(__mlx5_bit_off(typ, fld) & 0x1f))
#define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
__mlx5_mask(typ, fld))
#define MLX5_CAP_GEN(mdev, cap) \
        MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap)

        priv->params.rx_am_enabled = MLX5_CAP_GEN(mdev, cq_moderation);

I have attached the preprocessed source file, please build with:

arm-linux-gnueabi-gcc  -c en_rep.i  -Wall -Wno-pointer-sign
-Wno-unused-const-variable -O2 -march=armv7-a  -fno-strict-aliasing

Reply via email to