public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Keith Packard <keithp@keithp.com>
Cc: Kito Cheng <kito.cheng@sifive.com>,
	newlib@sourceware.org, kito.cheng@gmail.com,
	Aldy Hernandez <aldyh@redhat.com>,
	Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [PATCH] libm: Fixing overflow handling issue for scalbnf and scalbn
Date: Wed, 21 Jul 2021 09:59:44 +0200	[thread overview]
Message-ID: <YPfT8BlAygKzhC6t@calimero.vinschen.de> (raw)
In-Reply-To: <87wnplnevf.fsf@keithp.com>

On Jul 20 09:12, Keith Packard wrote:
> Kito Cheng <kito.cheng@sifive.com> writes:
> 
> > cc Aldy Hernandez <aldyh@redhat.com> and Andrew MacLeod <amacleod@redhat.com>,
> > 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


  reply	other threads:[~2021-07-21  7:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  8:50 Kito Cheng
2021-07-20 16:12 ` Keith Packard
2021-07-21  7:59   ` Corinna Vinschen [this message]
2021-07-21 23:33     ` Keith Packard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YPfT8BlAygKzhC6t@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=keithp@keithp.com \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).