summaryrefslogtreecommitdiff
path: root/user/gnucobol/0001-move-packed-decimal.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/gnucobol/0001-move-packed-decimal.patch')
-rw-r--r--user/gnucobol/0001-move-packed-decimal.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/user/gnucobol/0001-move-packed-decimal.patch b/user/gnucobol/0001-move-packed-decimal.patch
new file mode 100644
index 000000000..d5251172a
--- /dev/null
+++ b/user/gnucobol/0001-move-packed-decimal.patch
@@ -0,0 +1,30 @@
+See also:
+
+* https://sourceforge.net/p/gnucobol/bugs/904/
+
+diff -ur a/gnucobol-3.2/libcob/numeric.c b/gnucobol-3.2/libcob/numeric.c
+--- a/libcob/numeric.c 2023-08-18 01:07:41.324059298 +0000
++++ b/libcob/numeric.c 2023-08-18 01:31:31.294137417 +0000
+@@ -2739,17 +2739,12 @@
+ }
+ } else {
+ unsigned char *pos = fld2 + fld2_size - 1;
+- if (COB_FIELD_HAVE_SIGN (f2)) {
+- if (!fld1_sign) {
+- *pos &= 0xF0;
+- *pos |= 0x0C;
+- } else {
+- *pos &= 0xF0;
+- *pos |= fld1_sign;
+- }
+- } else {
+- *pos &= 0xF0;
++ if (!COB_FIELD_HAVE_SIGN (f2)) {
+ *pos |= 0x0F;
++ } else if (fld1_sign == 0x0D) {
++ *pos = (*pos & 0xF0) | 0x0D;
++ } else {
++ *pos = (*pos & 0xF0) | 0x0C;
+ }
+ if (!(COB_FIELD_DIGITS (f2) & 1) /* -> digits % 2 == 0 */) {
+ *fld2 &= 0x0F;