Explicit program mask manipulations

Programs created with the C/370™ V2 compiler and library that explicitly manipulated the program mask might require source changes.

Changes are required if you have one of the following types of programs:
  • A C program containing interlanguage calls (ILC), where the invoked code uses the S/370 decimal instructions that might generate an unmasked decimal overflow condition, requires modification for migration. Use either of the following two methods:
    • Preferred method: If the called routine is assembler, save the existing mask, set the new value, and when finished, restore the saved mask.
    • Change the C code so that the produced SIGFPE signal is ignored in the called code. In the following example, the SIGNAL calls surround the overflow-producing code. The SIGFPE exception handling is disabled before the problem signal is encountered, and then reenabled after it has been processed. See Figure 1.
  • A C program containing assembler ILCs that explicitly alter the program mask, and do not explicitly save and restore it, also requires modification for migration.

    If user code explicitly alters the state of the program mask, the value before modification must be saved, and the value restored to its former value after the modification. You must ensure that the decimal overflow program mask bit is enabled during the execution of C code. Failure to preserve the mask may result in unpredictable behavior.

These changes also apply in a System Programming C environment, and to Customer Information Control System (CICS®) programs in the handling and management of the PSW mask.

Figure 1. Statements that ignore SIGFPE exception and restore default exception handling
  signal(SIGFPE, SIG_IGN);   /* ignore exceptions */
    ...
    callit():                  /* in called routine */
    ...
    signal(SIGFPE, SIG_DFL);   /* restore default handling */