This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Potential bug with wide_int_storage::set_len
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: "Andre Vieira (lists)" <Andre dot SimoesDiasVieira at arm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 12 Oct 2016 19:59:04 +0200
- Subject: Re: Potential bug with wide_int_storage::set_len
- Authentication-results: sourceware.org; auth=none
- References: <57FE5EA6.1050301@arm.com>
> During the development of a patch I encountered some strange behavior
> and decided to investigate. The result of which is I think I found a bug
> with 'wide_int_storage::set_len' in gcc/wide-int.h.
>
> The function reads:
> inline void
> wide_int_storage::set_len (unsigned int l, bool is_sign_extended)
> {
> len = l;
> if (!is_sign_extended && len * HOST_BITS_PER_WIDE_INT > precision)
> val[len - 1] = sext_hwi (val[len - 1],
> precision % HOST_BITS_PER_WIDE_INT);
> }
The code certainly lacks a comment explaining the apparent discrepancy.
> Due to this, 'expand_expr' will expand a constant tree with unsigned
> integer type and value MAX_UINT to a rtx node (const_int -1).
As Jakub explained, that is as expected, even if a little surprising.
--
Eric Botcazou