Re: [PATCH] range-op-float: Fix up float_widen_lhs_range [PR126641]

Aldy Hernandez <[email protected]> Thu, 6 Aug 2026 17:50:41 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 04:27:41PM +0200, Jakub Jelinek wrote:
> On Thu, Aug 06, 2026 at 04:11:12PM +0200, Aldy Hernandez wrote:
> > I still think we should put in an assert in the real.cc code that dies
> > hard if we try to blow past the significant size, like I had in the
> > PR.  That way we can at least catch problems in this space without
> > having to go through the hell of memory corruption.
> 
> I'm certainly not against that assert, perhaps it can be gcc_checking_assert
> only though.
> 
> > Overall, I'm not a big fan of having to expose the internals of frange
> > in this manner.  The fact that we have to do this, means we're either
> > doing something wrong, or the API is missing something.  What could we
> > provide to make this cleaner?
> 
> I admit it is ugly, but I think that is the sign the APIs protect developers
> properly from using hacks like this.  In most cases, it is just fine if
> one needs to go through the union_ way you've used, if we add APIs that
> allow to change arbitrary bounds (e.g. set_lower_bound (i, value),
> set_upper_bound (i, value), set_num_ranges or something like that, it will
> make it easier to do such hacks everywhere.
> I'd hope this is the only spot that needs to do such stuff, which is why
> I went with the friend declaration.

Again, speaking from a deep well of ignorance here, maybe if we
absolutely need to touch internals here, we should make it a proper
member of the frange class?

Andrew, Richi, thoughts?

Aldy