On Wed, Oct 7, 2026 at 3:50 AM Roger Sayle <[email protected]> wrote:
>
>
> This minimal patch allows "../gcc/configure --enable-checking=rtl" to
> survive "make bootstrap" (for me on x86_64-pc-linux-gnu).  Curiously
> "--enable-checking=all" builds just fine.
>
> The failure mode is:
>
> In file included from ../../gcc/gcc/coretypes.h:479,
>                  from ../../gcc/gcc/gimple-ssa-warn-access.cc:26:
> In member function 'long int* wide_int_storage::write_val(unsigned int)',
>     inlined from 'void wi::copy(T1&, const T2&) [with T1 = wide_int_storage;
> T2 = generic_wide_int<wide_int_ref_storage<true, false> >]' at
> ../../gcc/gcc/wide-int.h:2187:37,
>     inlined from 'wide_int_storage& wide_int_storage::operator=(const T&)
> [with T = wi::hwi_with_prec]' at ../../gcc/gcc/wide-int.h:1247:12,
>     inlined from 'generic_wide_int<storage>&
> generic_wide_int<T>::operator=(const T&) [with T = wi::hwi_with_prec;
> storage = wide_int_storage]' at ../../gcc/gcc/wide-int.h:1002:23,
>     inlined from 'void irange_bitmask::set_unknown(unsigned int)' at
> ../../gcc/gcc/value-range.h:185:27,
>     inlined from 'virtual void irange::set_varying(tree)' at
> ../../gcc/gcc/value-range.h:1245:25,
>     inlined from 'int_range<N, RESIZABLE>::int_range(tree) [with unsigned
> int N = 3; bool RESIZABLE = true]' at ../../gcc/gcc/value-range.h:1207:15,
>     inlined from 'bool {anonymous}::memmodel_to_uhwi(tree, gimple*, long
> unsigned int*)' at ../../gcc/gcc/gimple-ssa-warn-access.cc:2870:41:
> ../../gcc/gcc/wide-int.h:1272:73: error: 'rng.int_range<3,
> true>::<unnamed>.irange::m_bitmask.irange_bitmask::m_value.generic_wide_int<
> wide_int_storage>::<unnamed>.wide_int_storage::u.wide_int_storage::<unnamed
> union>::valp' may be used uninitialized [-Werror=maybe-uninitialized]
>  1272 |   return UNLIKELY (precision > WIDE_INT_MAX_INL_PRECISION) ? u.valp
> : u.val;
>       |
> ^~~
> ../../gcc/gcc/gimple-ssa-warn-access.cc: In function 'bool
> {anonymous}::memmodel_to_uhwi(tree, gimple*, long unsigned int*)':
> ../../gcc/gcc/gimple-ssa-warn-access.cc:2870:21: note: 'rng' declared here
>  2870 |       int_range_max rng (TREE_TYPE (ord));
>       |                     ^~~
>
> Or to summarize, irange contains a member field called m_bitmask that
> doesn't explicitly get initialized, and (only) with flag_checking irange
> frequently calls verify_mask to ensure that m_bitmask's m_value and m_mask
> fields contain sensible values.  The solution is for irange's constructor
> to explicitly call the irange_bitmask constructor for its m_bitmask member.
> The one tiny wrinkle is that this requires the type's precision, which can
> be solved by adding a second constructor that specifies the precision,
> allowing int_range_max's constructor (aka int_range's constructor) to
> pass along the appropriate precision to irange_bitmask's constructor.
>
> Hopefully, that all makes sense.  Tested with make bootstrap following
> configure --enable-checking=rtl on x86_64-pc-linux-gnu.  Ok for mainline?


So this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126952 .  It
was bisected down to r17-3330-g4fe2072d5d16ce which was a jump
threading change. Which points to maybe now a missed jump threading
with --enable-checking=release (or --enable-checking=rtl without
extra) with respect to flag_checking.  I have not looked into your
patch yet.  Your analysis seems ok but without understanding why we
didn't warn before vs warn now, I am not sure which is the correct way
forward here.


>
>
> 2026-10-07  Roger Sayle  <[email protected]>
>
> gcc/ChangeLog
>         * value-range.h (irange::irange): Add a second constructor that
>         takes an explicit type precision.  In this new constructor,
>         initialize m_bitmask with the specified precision.
>         (int_range<unigned,bool>::int_range(tree)): Use the new
>         constructor for irange using the type's TYPE_PRECISION.
>
> Thanks in advance,
> Roger
> --
>

Reply via email to