Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/gnucobol-3.x' into gcos4gnucob…
Browse files Browse the repository at this point in the history
…ol-3.x
  • Loading branch information
ddeclerck committed Sep 26, 2024
2 parents 2c000f5 + 1104bda commit f5989ba
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 144 deletions.
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ NEWS - user visible changes -*- outline -*-

more work in progress

* Changes that potentially effect recompilation of existing programs:

** runtime checks for invalid numerical data in emitter fields of MOVE or SET
statements are now performed only when at least one receiver field
is of category numeric or numeric-edited. This enables programming
patterns where invalid numerical data (e.g, SPACES) encode "absent"
data

* Important Bugfixes

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

2024-09-25 Nicolas Berthier <[email protected]>

* typeck.c (cb_tree_is_numeric_ref_or_field)
(cb_tree_list_has_numeric_ref_or_field): new helper functions to check
whether a given item is of category numeric (edited or not)
* typeck.c (cb_emit_incompat_data_checks): use new helper function
* typeck.c (cb_emit_move, cb_emit_set_to): do not check for incompatible
data if no receiver field is of category numeric or numeric edited

2024-08-28 David Declerck <[email protected]>

* tree.c (char_to_precedence_idx, get_char_type_description, valid_char_order):
Expand Down
39 changes: 30 additions & 9 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,16 +1055,31 @@ cb_emit_list (cb_tree l)
return l;
}

static COB_INLINE COB_A_INLINE int
cb_tree_is_numeric_ref_or_field (cb_tree x, int include_numeric_edited) {
int cat;
if (!x || !CB_REF_OR_FIELD_P (x)) {
return 0;
}
cat = CB_TREE_CATEGORY (x);
return (cat == CB_CATEGORY_NUMERIC
|| (include_numeric_edited && cat == CB_CATEGORY_NUMERIC_EDITED));
}

static int
cb_tree_list_has_numeric_ref_or_field (cb_tree l) {
for (l;
l && !cb_tree_is_numeric_ref_or_field (CB_VALUE (l), 1);
l = CB_CHAIN (l));
return (l != NULL);
}

static void
cb_emit_incompat_data_checks (cb_tree x)
{
struct cb_field *f;

if (!x || x == cb_error_node) {
return;
}
if (!CB_REF_OR_FIELD_P (x)
|| CB_TREE_CATEGORY (x) != CB_CATEGORY_NUMERIC) {
if (!cb_tree_is_numeric_ref_or_field (x, 0)) {
return;
}
f = CB_FIELD_PTR (x);
Expand Down Expand Up @@ -12884,8 +12899,11 @@ cb_emit_move (cb_tree src, cb_tree dsts)
return;
}

/* validate / fix-up source, if requested */
cb_emit_incompat_data_checks (src);
/* validate / fix-up source, if at least one receiver is of category
numeric */
if (cb_tree_list_has_numeric_ref_or_field (dsts)) {
cb_emit_incompat_data_checks (src);
}

/* FIXME: this is way to much to cater for sum field */
src = cb_check_sum_field (src);
Expand Down Expand Up @@ -13725,8 +13743,11 @@ cb_emit_set_to (cb_tree vars, cb_tree src)
return;
}

/* validate / fix-up source, if requested */
cb_emit_incompat_data_checks (src);
/* validate / fix-up source, if at least one receiver is of category
numeric */
if (cb_tree_list_has_numeric_ref_or_field (vars)) {
cb_emit_incompat_data_checks (src);
}

/* Emit statements. */
for (l = vars; l; l = CB_CHAIN (l)) {
Expand Down
10 changes: 10 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

2024-07-27 Chuck Haatvedt <[email protected]>

* screenio.c: In preparation for Multiple Window support
added static WINDOW pointer "mywin", all curses functions
which either implicitly or explicitly referenced the
stdscr WINDOW pointer were changed to use the window
specific functions using mywin except the getch function
remains unchanged. The wgetch function caused the mouse
not to be recognized.

2024-09-20 Chuck Haatvedt <[email protected]>

* screenio.c (cob_screen_get_all) fixed Bug #990
Expand Down
Loading

0 comments on commit f5989ba

Please sign in to comment.