public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] Remove assert from set_nonzero_bits.
@ 2022-10-04 17:52 Aldy Hernandez
  2022-10-04 18:45 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2022-10-04 17:52 UTC (permalink / raw)
  To: GCC patches; +Cc: Jeff Law, Andrew MacLeod, Aldy Hernandez

The assert removed by this patch was there to keep users from passing
masks of incompatible types.  The self tests are passing host wide
ints down (set_nonzero_bits (-1)), which seem to be 32 bits, whereas
some embedded targets have integer_type_node's of 16-bits.  This is
causing problems in m32c-elf, among others.

I suppose there's no harm in passing a 32-bit mask, because
set_nonzero_bits calls wide_int::from() to convert the mask to the
appropriate type.  So we can remove the assert.

Sorry for the pain Jeff.

gcc/ChangeLog:

	* value-range.cc (irange::set_nonzero_bits): Remove assert.
---
 gcc/value-range.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index afb26a40083..a307559b654 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -2913,7 +2913,6 @@ irange::set_nonzero_bits (const wide_int_ref &bits)
 {
   gcc_checking_assert (!undefined_p ());
   unsigned prec = TYPE_PRECISION (type ());
-  gcc_checking_assert (prec == bits.get_precision ());
 
   // Drop VARYINGs with a nonzero mask to a plain range.
   if (m_kind == VR_VARYING && bits != -1)
-- 
2.37.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [COMMITTED] Remove assert from set_nonzero_bits.
  2022-10-04 17:52 [COMMITTED] Remove assert from set_nonzero_bits Aldy Hernandez
@ 2022-10-04 18:45 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2022-10-04 18:45 UTC (permalink / raw)
  To: Aldy Hernandez, GCC patches; +Cc: Andrew MacLeod


On 10/4/22 11:52, Aldy Hernandez wrote:
> The assert removed by this patch was there to keep users from passing
> masks of incompatible types.  The self tests are passing host wide
> ints down (set_nonzero_bits (-1)), which seem to be 32 bits, whereas
> some embedded targets have integer_type_node's of 16-bits.  This is
> causing problems in m32c-elf, among others.
>
> I suppose there's no harm in passing a 32-bit mask, because
> set_nonzero_bits calls wide_int::from() to convert the mask to the
> appropriate type.  So we can remove the assert.
>
> Sorry for the pain Jeff.
>
> gcc/ChangeLog:
>
> 	* value-range.cc (irange::set_nonzero_bits): Remove assert.

Thanks.  I'll respin everything that failed this AM and see where we are.


jeff



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-04 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 17:52 [COMMITTED] Remove assert from set_nonzero_bits Aldy Hernandez
2022-10-04 18:45 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).