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

Jakub Jelinek <[email protected]> Fri, 7 Aug 2026 00:14:53 +0200
Newsgroups gmane.comp.gcc.patches
Message-ID <anUHXTvBHEte5ToN@tucnak>
On Thu, Aug 06, 2026 at 10:39:56PM +0200, Aldy Hernandez wrote:
> On Thu, Aug 06, 2026 at 07:32:17PM +0200, Jakub Jelinek wrote:
> > Hi!
> > 
> > On Thu, Aug 06, 2026 at 06:25:35PM +0200, Aldy Hernandez wrote:
> > > > Not sure I completely follow exactly, but can you simply make
> > > > float_widen_lhs_range a public method of frange? it always seems to be a
> > > > copy that is been adjusted anyway.. so instead of
> > > > 
> > > > frange wlhs = float_widen_lhs_range (type, lhs); you'd do something like
> > > > frange wlhs = lhs; wlhs.widen (type);
> > > 
> > > Exactly, that's what I meant.
> > 
> > So like this?
> 
> LGTM.

Unfortunately it doesn't work :(.
On i686-linux
../../../../libphobos/src/std/math/exponential.d -quiet -dumpdir std/math/.libs/ -dumpbase exponential.d -dumpbase-ext .d -mtune=generic -march=pentiumpro -g -O2 -Wall -fchecking=1 -fversion=Shared -frelease -ffunction-sections -fdata-sections -fpreview=dip1000 -fpreview=dtorfields -fpreview=fieldwise -fPIC -fversion=Shared -iprefix /home/jakub/src/gcc/obj93/gcc/../lib/gcc/i686-pc-linux-gnu/17.0.0/ -isystem /home/jakub/src/gcc/obj93/./gcc/include -isystem /home/jakub/src/gcc/obj93/./gcc/include-fixed -nostdinc -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include -I ../../../../libphobos/src -I ../../../../libphobos/libdruntime -I ../libdruntime -I . -o /tmp/ccWYTDdp.s -v
#0  internal_error (gmsgid=0xc9f41a7 "in %s, at %s:%d") at ../../gcc/diagnostic-global-context.cc:778
#1  0x0b4d9ab4 in fancy_abort (file=0xc38cd34 "../../gcc/real.cc", line=402, function=0xc38cd20 "set_significand_bit") at ../../gcc/diagnostics/context.cc:1813
#2  0x08aa8014 in set_significand_bit (r=0xffff7728, n=160) at ../../gcc/real.cc:402
#3  0x08ab0548 in real_nextafter (r=0xffff7770, fmt=..., x=0xffff7888, y=0xd0ed6d4 <dconstinf>) at ../../gcc/real.cc:5397
#4  0x08a98f1a in frange_nextafter (mode=E_DFmode, value=..., inf=...) at ../../gcc/range-op-float.cc:314
#5  0x09079829 in frange_fusible_p (mode=E_DFmode, a_max=..., b_min=...) at ../../gcc/value-range.cc:1041
#6  0x0907cb83 in frange::verify_range (this=0xffff7964) at ../../gcc/value-range.cc:1677
#7  0x0907b705 in frange::operator= (this=0xffff7964, src=...) at ../../gcc/value-range.cc:1487
#8  0x08a9fd88 in operator_cast::op1_range (this=0xc38699c <op_cast>, r=..., type=0xf70e2c00, lhs=..., op2=...) at ../../gcc/range-op-float.cc:2949
#9  0x08a7cc1f in range_op_handler::op1_range (this=0xffff9050, r=..., type=0xf70e2c00, lhs=..., op2=..., rel=...) at ../../gcc/range-op.cc:330
So, I guess I'll need to go the way you've suggested, widen modifying
the current class, then it doesn't have to be copied around and so
verification in operator= will hopefully not trigger.

	Jakub