Skip to content

Commit

Permalink
Fix binary size computation for binary-size=2-4-8
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Oct 29, 2024
1 parent 480b5fd commit 08f3cf0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
8 changes: 2 additions & 6 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -2561,12 +2561,8 @@ compute_binary_size (struct cb_field *f, const int size)
(size <= 9) ? 4 : (size <= 18) ? 8 : 16);
return;
case CB_BINARY_SIZE_2_4_8:
if (f->flag_real_binary && size <= 2) {
f->size = 1;
} else {
f->size = ((size <= 4) ? 2 :
(size <= 9) ? 4 : (size <= 18) ? 8 : 16);
}
f->size = ((size <= 4) ? 2 :
(size <= 9) ? 4 : (size <= 18) ? 8 : 16);
return;
case CB_BINARY_SIZE_1__8:
if (f->pic->have_sign) {
Expand Down
16 changes: 8 additions & 8 deletions tests/testsuite.src/data_binary.at
Original file line number Diff line number Diff line change
Expand Up @@ -2512,8 +2512,8 @@ SVPP9(18): 8

AT_CHECK([$COMPILE -fbinary-size=2-4-8 prog.cob], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
[V9(1): 1
V9(2): 1
[V9(1): 2
V9(2): 2
V9(3): 2
V9(4): 2
V9(5): 4
Expand All @@ -2530,8 +2530,8 @@ V9(15): 8
V9(16): 8
V9(17): 8
V9(18): 8
VPP9(1): 1
VPP9(2): 1
VPP9(1): 2
VPP9(2): 2
VPP9(3): 2
VPP9(4): 2
VPP9(5): 4
Expand All @@ -2548,8 +2548,8 @@ VPP9(15): 8
VPP9(16): 8
VPP9(17): 8
VPP9(18): 8
SV9(1): 1
SV9(2): 1
SV9(1): 2
SV9(2): 2
SV9(3): 2
SV9(4): 2
SV9(5): 4
Expand All @@ -2566,8 +2566,8 @@ SV9(15): 8
SV9(16): 8
SV9(17): 8
SV9(18): 8
SVPP9(1): 1
SVPP9(2): 1
SVPP9(1): 2
SVPP9(2): 2
SVPP9(3): 2
SVPP9(4): 2
SVPP9(5): 4
Expand Down

0 comments on commit 08f3cf0

Please sign in to comment.