public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Fengkai Sun <qcloud1014@gmail.com>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: why don't setjmp save MXCSR register and x87 control word?
Date: Wed, 17 Mar 2021 21:08:32 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2103172104130.139917@digraph.polyomino.org.uk> (raw)
In-Reply-To: <41f234be-0fbe-0ae1-74be-084bab59bef6@linaro.org>

On Wed, 17 Mar 2021, Adhemerval Zanella via Libc-alpha wrote:

> Because afaik the C standard specify that any state of floating-point status 
> flag should *not* be saved:
> 
>   7.13 Nonlocal jumps <setjmp.h>
>   [...]
>   It does not include the state of the floating-point status flags, of open files, 
>   or of any other component of the abstract machine.

Indeed, the floating-point exception flags, rounding mode and any other 
such state are essentially thread-local variables, and should be handled 
just like such variables.  setjmp and longjmp don't save and restore 
thread-local or global variables, so they shouldn't save and restore 
floating-point flags or control modes either.

(In psABI terms, we invented the term "limited-access bits" to describe 
this state in the 32-bit Power Architecture ABI.)

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2021-03-17 21:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF6YOcOnWpqxsp+tbu-29HHaw7+sj=4jR-ZPcmEq=po6F5u-yg@mail.gmail.com>
2021-03-17 18:59 ` Adhemerval Zanella
2021-03-17 21:08   ` Joseph Myers [this message]

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=alpine.DEB.2.22.394.2103172104130.139917@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=qcloud1014@gmail.com \
    /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).