-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: gcos4gnucobol-3.x
Are you sure you want to change the base?
Conversation
That's good - let's expand this by adding the non P versions with expected same size and one run for each of the Thanks again! |
Updated. I'm a bit surprised by the results for |
yes, so the testcase uncovered a bug (that trunk may not have any more...) |
Also present in GC4. Apparently this is caused by this (
And this (
I'd say it suffices to not set But I'm also wondering, when |
Actually nope, I understand we must keep However removing the specific case for |
Rechecked (that complete check and specification below took more than two hours :-/ maybe I start to get old...): for Attention: Per GCOS docs the right binary-size option would be Also: acu-strict.conf currently has So I've gone through the annotate/blame to check where the changes come from. For field.c that's May 2007, history:r2575
That should obviously be the case and we should have a testcase for this... And this case was, back then, totally correct, which should answer your question. The real issue is the addition of the flag_real_binary to
This end result is correct (it is mostly about binary truncation instead of arithmetic one) but that actual change has an effect on the size generation as we found out - that it should not have for COMP-5! Even tree.h To fix it (you know, when you work on the test cases I can focus on the code...) case CB_USAGE_COMP_5:
- f->flag_real_binary = 1; and codegen.c: - 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;
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;
+ }
} and of course Changelog:
and NEWS +** #NNN: dialects without support of single byte binary data
+ will now generate at least 2 bytes of storage for COMP-5 elements; this
+ applies to all non-standard dialects but GnuCOBOL (default) and Micro Focus;
+ that changes the group length of records containing elements with less than
+ 3 digits and also passes different sizes via CALL, which may need program
+ adjustments.
+
+** -std=acu / -std=acu-strict now generate BINARY and COMP-5 with at least
+ 2 bytes of storage; the comment for #NNN above applies; if you want
+ to still use the sizes used since GnuCOBOL 2.2 with those dialects:
+ add -fbinary-size=1-2-4-8 to your compile options
+
* Important Bugfixes Which I think should both the existing testcases, the one you've added and the one new for If you prefer, I could also do this commit upstream. |
c99f785
to
63c7630
Compare
Yeah, that's definately something we should consider (back then, we just chosed what was the "closest").
Tests added ;)
Yup, reading the code a bit more, I get why this was made this way.
Yes, that seems to fix everything.
Well, I included your changes in this PR, so I can take care of that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please include the last change as well: config/acu-strict.conf (+Changelog)
-binary-size: 1-2-4-8 # not verified yet
+binary-size: 2-4-8 # TODO: add 2-4-8-12-16
Done. Just realized I created the SVN ticket using a very old personal account of mine instead of my new "profesional" account - don't know if this can be changed... |
The creator change would need an export, adjustment and re-import, so there would have to be a very convincing reason to do so. But I've adjusted the text and assigned the ticket to your new account. BTW: congrats for this nice issue number :-) |
Alright.
Yeah, do I get a prize ? 😉 So, is this PR "ready for SVN" ? |
I've started doc + testsuite adjustments, with the later resulting in realizing about a missing feature...
If that's fine with you I'd do the upstream commit afterwards.
|
Alright, I leave it to you ;) |
This adds a test for COMP-5 binary size in presence of P.