Skip to content

Commit

Permalink
Disable some SUB optimization that breaks FLD0370B in data_display.at
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Nov 21, 2024
1 parent 3bd6942 commit 2d0a54f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -7828,11 +7828,13 @@ cb_build_optim_sub (cb_tree v, cb_tree n)
{
if (CB_REF_OR_FIELD_P (v)) {
const struct cb_field *f = CB_FIELD_PTR (v);
#if 0 /* CHECKME: this breaks FLD0370B in data_display.at ADD/SUB w/o SIZE ERROR */
if (cb_is_integer_field(f)
&& cb_is_integer_expr (n)
&& cb_binary_truncate) {
return cb_build_assign (v, cb_build_binary_op (v, '-', n));
}
#endif
if (!f->pic
|| f->pic->scale) {
return CB_BUILD_FUNCALL_3 ("cob_sub_int", v,
Expand Down Expand Up @@ -7908,6 +7910,7 @@ cb_build_optim_sub (cb_tree v, cb_tree n)
v, n_negative);
}
}
#if 0 /* CHECKME: this breaks FLD0370B in data_display.at ADD/SUB w/o SIZE ERROR */
if (CB_NUMERIC_LITERAL_P (n)
&& (f->usage == CB_USAGE_PACKED || f->usage == CB_USAGE_DISPLAY)
&& (f->pic && f->pic->scale == 0)
Expand All @@ -7920,6 +7923,7 @@ cb_build_optim_sub (cb_tree v, cb_tree n)
&& cb_is_integer_expr (n)) {
return cb_build_assign (v, cb_build_binary_op (v, '-', n));
}
#endif
}
return CB_BUILD_FUNCALL_3 ("cob_sub_int", v,
cb_build_cast_int (n), cb_int0);
Expand Down

0 comments on commit 2d0a54f

Please sign in to comment.