sigFpe Class Reference

Set up trapping for floating point exceptions (signal FPE). More...

Public Member Functions

 sigFpe ()
 Construct null. More...
 
 ~sigFpe ()
 Destructor. More...
 
void set (const bool verbose)
 Activate SIGFPE signal handler when FOAM_SIGFPE is set. More...
 

Static Public Member Functions

static void fillNan (UList< scalar > &)
 Fill block of data with NaN. More...
 

Static Public Attributes

static bool mallocNanActive_ = false
 Flag to indicate mallocNan is enabled. More...
 

Detailed Description

Set up trapping for floating point exceptions (signal FPE).

Controlled by two env vars:

  • FOAM_SIGFPE
    Exception trapping
  • FOAM_SETNAN
    Initialisation of all malloced memory to NaN. If FOAM_SIGFPE also set, this will cause usage of uninitialised scalars to trigger an abort.
    Source files

Definition at line 67 of file sigFpe.H.

Constructor & Destructor Documentation

◆ sigFpe()

sigFpe ( )

Construct null.

Definition at line 111 of file sigFpe.C.

◆ ~sigFpe()

~sigFpe ( )

Destructor.

Definition at line 119 of file sigFpe.C.

References Foam::abort(), Foam::env(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

Member Function Documentation

◆ set()

void set ( const bool  verbose)

Activate SIGFPE signal handler when FOAM_SIGFPE is set.

Fill memory with NaN when FOAM_SETNAN is set

Definition at line 150 of file sigFpe.C.

References Foam::abort(), Foam::endl(), Foam::env(), Foam::FatalError, FatalErrorInFunction, and Foam::Info.

Here is the call graph for this function:

◆ fillNan()

void fillNan ( UList< scalar > &  lst)
static

Fill block of data with NaN.

Definition at line 46 of file sigFpe.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::jobInfo_, sigFpe::mallocNanActive_, Foam::Perr, and jobInfo::signalEnd().

Here is the call graph for this function:

Member Data Documentation

◆ mallocNanActive_

bool mallocNanActive_ = false
static

Flag to indicate mallocNan is enabled.

Definition at line 103 of file sigFpe.H.

Referenced by sigFpe::fillNan().


The documentation for this class was generated from the following files: