[2/12] lto-streamer-in: Adjust assert [PR102989]

Message ID ZNPX2msMcQsvxzgO@tucnak
State Unresolved
Headers
Series GCC _BitInt support [PR102989] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jakub Jelinek Aug. 9, 2023, 6:15 p.m. UTC
  Hi!

With _BitInt(575) or any other _BitInt(513) or larger constants we can
run into this assertion.  MAX_BITSIZE_MODE_ANY_INT is just a value from
which WIDE_INT_MAX_PRECISION is derived.

2023-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/102989
	* lto-streamer-in.cc (lto_input_tree_1): Assert TYPE_PRECISION
	is up to WIDE_INT_MAX_PRECISION rather than MAX_BITSIZE_MODE_ANY_INT.


	Jakub
  

Comments

Richard Biener Aug. 10, 2023, 7:19 a.m. UTC | #1
On Wed, 9 Aug 2023, Jakub Jelinek wrote:

> Hi!
> 
> With _BitInt(575) or any other _BitInt(513) or larger constants we can
> run into this assertion.  MAX_BITSIZE_MODE_ANY_INT is just a value from
> which WIDE_INT_MAX_PRECISION is derived.

OK.

Richard.

> 2023-08-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c/102989
> 	* lto-streamer-in.cc (lto_input_tree_1): Assert TYPE_PRECISION
> 	is up to WIDE_INT_MAX_PRECISION rather than MAX_BITSIZE_MODE_ANY_INT.
> 
> --- gcc/lto-streamer-in.cc.jj	2023-07-17 09:07:42.078283882 +0200
> +++ gcc/lto-streamer-in.cc	2023-07-27 15:03:24.255234159 +0200
> @@ -1888,7 +1888,7 @@ lto_input_tree_1 (class lto_input_block
>  
>        for (i = 0; i < len; i++)
>  	a[i] = streamer_read_hwi (ib);
> -      gcc_assert (TYPE_PRECISION (type) <= MAX_BITSIZE_MODE_ANY_INT);
> +      gcc_assert (TYPE_PRECISION (type) <= WIDE_INT_MAX_PRECISION);
>        result = wide_int_to_tree (type, wide_int::from_array
>  				 (a, len, TYPE_PRECISION (type)));
>        streamer_tree_cache_append (data_in->reader_cache, result, hash);
> 
> 	Jakub
>
  

Patch

--- gcc/lto-streamer-in.cc.jj	2023-07-17 09:07:42.078283882 +0200
+++ gcc/lto-streamer-in.cc	2023-07-27 15:03:24.255234159 +0200
@@ -1888,7 +1888,7 @@  lto_input_tree_1 (class lto_input_block
 
       for (i = 0; i < len; i++)
 	a[i] = streamer_read_hwi (ib);
-      gcc_assert (TYPE_PRECISION (type) <= MAX_BITSIZE_MODE_ANY_INT);
+      gcc_assert (TYPE_PRECISION (type) <= WIDE_INT_MAX_PRECISION);
       result = wide_int_to_tree (type, wide_int::from_array
 				 (a, len, TYPE_PRECISION (type)));
       streamer_tree_cache_append (data_in->reader_cache, result, hash);