Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,275
    • Issues 1,275
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 57
    • Merge requests 57
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPC
  • FPC SourceFPC Source
  • Issues
  • #16263
Closed
Open
Created Apr 12, 2010 by FPC Admin account@fpc_adminOwner

SSE Floating point exceptions not masked

Original Reporter info from Mantis: lennert
  • Reporter name:

Description:

When working with SSE instructions the MXCSR control/status word is not properly initialized. The default MXCSR value at reset should be $1f80, whereas it is set to $1900 by the Lazarus runtime. The default value is a.o. specified at ftp://download.intel.com/design/PentiumII/manuals/24319102.PDF, page 3-345.

As a result the exception "External exception C00002B5." can be raised, also known as "Multiple floating point traps".

The relevant code can be found in i386.inc/x86_64.inc:

mxcsr : dword = MM_MaskUnderflow or MM_MaskPrecision or MM_MaskDenorm;

By default, all floating point exceptions should be masked by initializing mxcsr as follows:

mxcsr : dword = MM_MaskInvalidOp or MM_MaskDenorm or MM_MaskDivZero or MM_MaskOverflow or MM_MaskUnderflow or MM_MaskPrecision;

Steps to reproduce:

Create an empty project
Load a DLL that utilizes SSE instructions and branch prediction
Call a function that is exported by this DLL

Additional information:

This exception showed up when I was working with a DLL compiled by the Intel C++ compiler. My assumption is that the compiler uses branch prediction to improve speed. As a result of a misprediction a division by zero occurred and the result of the division by zero was discarded later. When the "division by zero" exception is not masked, the exception specified above shows up and execution of the program stops.

Mantis conversion info:

  • Mantis ID: 16263
  • Build: 22279
  • Version: 2.2.4
  • Fixed in version: 2.6.0
  • Fixed in revision: 16347 (#c14574bb)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking