x86 32-bit: an unmasked FP exception traps after interval code has returned

Open
#75 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
44/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start with the x87 exception masking and control-word restoration paths described in the issue, then compare the Clang and GCC behavior in the linked Godbolt example. Check related issue #35 for context. Done when an unmasked overflow exception no longer traps after interval code returns on 32-bit x86.

Written by the indexing model from the issue text.

Description

On 32-bit x86, where double arithmetic runs on the x87 unit, the rounding control masks every exception while interval code runs, so the overflow below doesn't trap inside it.

But the overflow flag stays pending, and restoring the caller's control word unmasks it again, so the trap fires afterwards: in Boost's own restore (Clang), or at the caller's next x87 instruction, which has nothing to do with the interval (GCC).

Godbolt

Related: #35.

Dominant language
C++
Stars
30
Forks
49
Avg merge
2d 15h
Merged PRs (30d)
7

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/interval

All issues in boostorg/interval

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.