3.2.8 ARM floating-point compiler extensions to the C99 interface

The ARM® C library provides some extensions to the C99 interface to enable it to do everything that the ARM floating-point environment is capable of. This includes trapping and untrapping individual exception types, and installing custom trap handlers.

Note:

The ARM Compiler toolchain does not support floating-point exception trapping for AArch64 targets.

Note:

The following functionality requires a floating-point model that supports exceptions. In ARM Compiler 6 this is disabled by default, and can be enabled by the armclang command-line option -ffp-mode=full.

The types fenv_t and fexcept_t are not defined by C99 to be anything in particular. The ARM compiler defines them both to be the same structure type.

In AArch32 state, fenv_t and fexcept_t have the following structure:

typedef struct{
    unsigned __statusword;
    __ieee_handler_t __invalid_handler;
    __ieee_handler_t __divbyzero_handler;
    __ieee_handler_t __overflow_handler;
    __ieee_handler_t __underflow_handler;
    __ieee_handler_t __inexact_handler;
} fenv_t, fexcept_t;

The members of this structure are:

  • __statusword, the same status variable that the function __ieee_status() sees, laid out in the same format.

  • Five function pointers giving the address of the trap handler for each exception. By default, each is NULL. This means that if the exception is trapped, the default exception trap action happens. The default is to cause a SIGFPE signal.

In AArch64 state, fenv_t and fexcept_t have the following structure:

typedef struct{
    unsigned __statusword;
} fenv_t, fexcept_t;
Non-ConfidentialPDF file icon PDF versionARM 100073_0607_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.