COBOL now consistently displays COMP-1/-2 variables with IBM dialect.
GCC's COBOL compiler now correctly displays `COMP-1` and `COMP-2` variables when using the IBM dialect, fixing an output formatting mismatch.
This commit ensures that GCC’s COBOL frontend properly formats and displays COMP-1 and COMP-2 variables when the -dialect ibm option is active. This addresses a previously reported bug where the output for these data types did not align with IBM COBOL’s expected formatting. The fix involves an update to the format_for_display_internal function in libgcobol, crucial for maintaining compatibility and correct behavior for COBOL programs targeting the IBM environment.
In Details
This change resolves an issue in the libgcobol runtime library, specifically within the format_for_display_internal function, which is responsible for converting internal data representations to displayable strings. The COMP-1 (single-precision floating-point) and COMP-2 (double-precision floating-point) data types, when displayed under the -dialect ibm setting, were not adhering to the IBM COBOL specification for output formatting. This fix updates the formatting logic to ensure that symbolic representations of these floating-point values, such as the example in PR cobol/125616, ar…
For Context
COBOL is a programming language widely utilized in business, and different versions or "dialects" exist, such as the one used by IBM mainframes. When you write a COBOL program and tell it to DISPLAY a number that's stored in a special internal format like COMP-1 or COMP-2 (which are essentially single- and double-precision floating-point numbers), the exact way that number appears on the screen can vary between different COBOL compilers or platforms. This update ensures that when you compile your COBOL code with GCC and specify the IBM dialect (using -dialect ibm), the output for COMP-1 and COMP-2 numbers will precisely match what an IBM COBOL compiler would produce. This is a bug fix that makes GCC's COBOL compiler more compliant with the IBM standard, which is vital for users who need their programs to behave identically across different COBOL environments.