Re: [PATCH] libm: Fixing overflow handling issue for scalbnf and scalbn

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jul 20 09:12, Keith Packard wrote:
> Kito Cheng <[email protected]> writes:
> 
> > cc Aldy Hernandez <[email protected]> and Andrew MacLeod <[email protected]>,
> > they are author of new VRP analysis for GCC, just to make sure I didn't
> > mis-understanding or mis-interpreting anything on GCC site.
> >
> > GCC 11 have better value range analysis, that give GCC more confidence
> > to perform more aggressive optimization, but it cause scalbn/scalbnf get
> > wrong result.
> 
> C doesn't specify what happens when signed integer values overflow;
> compiler developers believe that gives them the license to do this kind
> of "optimization". This patch makes the code more compliant with the C
> spec.
> 
> The only way to get known overflow behavior would be to use unsigned
> integers, but as this code depends on signed comparisons, that isn't
> practical here.
> 
> I've added tests for this case to the picolibc test suite and verified
> that your patch corrects this issue on 32-bit ARM using GCC 11.
> 
> -- 
> -keith

Thanks for verifying.  PUshed.


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.