Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add COMP-5 binary size test #197

Open
wants to merge 3 commits into
base: gcos4gnucobol-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ NEWS - user visible changes -*- outline -*-
patterns where invalid numerical data (e.g, SPACES) encode "absent"
data

** dialects without support for single-byte binary data will now generate at
least 2 bytes of storage for COMP-5 elements, where it previously generated
1 byte of storage; this applies to all non-standard dialects except GnuCOBOL
(default) and Micro Focus; this change adjusts the group length of records
containing elements with less than 3 digits, and also passes different sizes
via CALL, which may require program adjustments (either cater for the size
change or, if supported by the dialect, switch to USAGE BINARY-CHAR).
For details see Bug #1000

** -std=acu / -std=acu-strict now generate BINARY and COMP-5 with at least
2 bytes of storage; see the notes for #1000 above; if you still want to
use the sizes that were previously generated by GnuCOBOL with those
dialects, then add -fbinary-size=1-2-4-8 to your compile options

* Important Bugfixes

** #904: MOVE PACKED-DECIMAL unsigned to signed led to bad sign
Expand Down
8 changes: 8 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

2024-10-29 Simon Sobisch <[email protected]>

BUG #1000: Wrong binary size computed for COMP-5 PIC 9
and PIC 99 when binary-size=2-4-8
* field.c (validate_elementary_item): only set flag_real_binary for
BINARY-CHAR/BINARY-SHORT/BINARY-LONG/BINARY-DOUBLE
* codegenc (output_attr): generate COB_FLAG_REAL_BINARY also for COMP-5

2024-10-02 Simon Sobisch <[email protected]>

* pplex.l (output_line_directive): extracted from other places and
Expand Down
27 changes: 14 additions & 13 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,27 +1630,28 @@ output_attr (const cb_tree x)
if (f->flag_binary_swap) {
flags |= COB_FLAG_BINARY_SWAP;
}
if (f->flag_real_binary) {
if (f->flag_real_binary
|| f->usage == CB_USAGE_COMP_5) {
flags |= COB_FLAG_REAL_BINARY;
}
if (f->flag_is_pointer) {
flags |= COB_FLAG_IS_POINTER;
}
if (cb_binary_truncate &&
f->usage == CB_USAGE_BINARY &&
!f->flag_real_binary) {
if (cb_binary_truncate
&& f->usage == CB_USAGE_BINARY
&& !f->flag_real_binary) {
flags |= COB_FLAG_BINARY_TRUNC;
}

if (type == COB_TYPE_NUMERIC_BINARY
&& f->usage == CB_USAGE_INDEX) {
flags |= COB_FLAG_REAL_BINARY;
type = COB_TYPE_NUMERIC_COMP5;
} else
if (type == COB_TYPE_NUMERIC_BINARY
&& (f->flag_binary_swap || f->flag_real_binary)
&& (f->flag_indexed_by || f->index_type || f->flag_internal_register)) {
type = COB_TYPE_NUMERIC_COMP5;
if (type == COB_TYPE_NUMERIC_BINARY) {
if (f->usage == CB_USAGE_INDEX) {
flags |= COB_FLAG_REAL_BINARY;
type = COB_TYPE_NUMERIC_COMP5;
} else
if ((f->flag_binary_swap || f->flag_real_binary)
&& (f->flag_indexed_by || f->index_type || f->flag_internal_register)) {
type = COB_TYPE_NUMERIC_COMP5;
}
}
switch (f->usage) {
case CB_USAGE_COMP_6:
Expand Down
5 changes: 0 additions & 5 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,9 +2269,6 @@ validate_elementary_item (struct cb_field *f)
f->pic = cb_build_binary_picture ("BINARY-DOUBLE", 18, 0);
f->flag_real_binary = 1;
break;
case CB_USAGE_COMP_5:
f->flag_real_binary = 1;
break;
default:
break;
}
Expand Down Expand Up @@ -2516,8 +2513,6 @@ setup_parameters (struct cb_field *f)
break;

case CB_USAGE_COMP_5:
f->flag_real_binary = 1;
/* Fall-through */
case CB_USAGE_COMP_X:
case CB_USAGE_COMP_N:
if (f->pic->category == CB_CATEGORY_ALPHANUMERIC) {
Expand Down
4 changes: 4 additions & 0 deletions config/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2024-10-31 Simon Sobisch <[email protected]>

* acu-strict.conf: change binary-size from 1-2-4-8 to 2-4-8

2024-08-17 Ammar Almoris <[email protected]>

FR #474: add runtime configuration to hide cursor for extended screenio
Expand Down
2 changes: 1 addition & 1 deletion config/acu-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ indirect-redefines: yes
# 15 - 16 15 - 16 7
# 17 - 18 17 - 18 8
#
binary-size: 1-2-4-8 # not verified yet
binary-size: 2-4-8 # TODO: add 2-4-8-12-16

# Numeric truncation according to ANSI
binary-truncate: yes
Expand Down
Loading
Loading